@foxy.io/elements 1.37.0-beta.1 → 1.37.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-email-template-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +3 -0
- package/dist/cdn/translations/gift-card-code-form/en.json +1 -0
- package/dist/cdn/translations/gift-card-form/en.json +1 -0
- package/dist/cdn/translations/transaction/en.json +3 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +4 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +15 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/index.d.ts +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js +2 -0
- package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.d.ts +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +15 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0564def4.js";import"./shared-b15d45b1.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-b293a928.js";import{b as t,I as e}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-bb43f0ad.js";import{_ as r,B as s}from"./shared-d1195c27.js";import{N as a}from"./shared-d1dfac4d.js";import{h as o}from"./shared-ba5c42c7.js";import{a as n}from"./shared-fefaece7.js";import{i}from"./shared-53e42a77.js";import"./shared-5fd5805c.js";import"./shared-b4b9735c.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-00b50480.js";import"./shared-15ded782.js";import"./shared-00cd0e86.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-4e709717.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-1aff7995.js";import"./shared-019348d7.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./foxy-copy-to-clipboard.js";import"./shared-b7889b37.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-fcdb896f.js";let l,c=t=>t;customElements.define("foxy-internal-email-template-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return r(r({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,e="fail"===t?"error":"";return o(l||(l=c` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),`${this.theme} ${null!=e?e:""}`.trim(),"busy"===t||this.disabled,this.__submit,t)}async __submit(){var t,e;if("busy"!==this.__state)try{this.__state="busy";const r=new a.API(this),s=await r.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=s.ok?"idle":"fail",s.ok&&(null===(e=this.nucleon)||void 0===e||e.refresh())}catch(t){this.__state="fail"}}});let h,m=t=>t;const d=n(e,"email-template-form");class f extends d{constructor(){super(...arguments),this.__templateLanguageOptions=[{rawLabel:"Nunjucks",value:"nunjucks"},{rawLabel:"Handlebars",value:"handlebars"},{rawLabel:"Pug",value:"pug"},{rawLabel:"Twig",value:"twig"},{rawLabel:"EJS",value:"ejs"}],this.__toggleGetValue=()=>!!this.form.subject,this.__toggleSetValue=t=>{this.edit({subject:
|
|
1
|
+
import"./shared-0564def4.js";import"./shared-b15d45b1.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-b293a928.js";import{b as t,I as e}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-bb43f0ad.js";import{_ as r,B as s}from"./shared-d1195c27.js";import{N as a}from"./shared-d1dfac4d.js";import{h as o}from"./shared-ba5c42c7.js";import{a as n}from"./shared-fefaece7.js";import{i}from"./shared-53e42a77.js";import"./shared-5fd5805c.js";import"./shared-b4b9735c.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-00b50480.js";import"./shared-15ded782.js";import"./shared-00cd0e86.js";import"./shared-6524d421.js";import"./shared-4215bff2.js";import"./shared-651c44fa.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-4e709717.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-1aff7995.js";import"./shared-019348d7.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./foxy-copy-to-clipboard.js";import"./shared-b7889b37.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-fcdb896f.js";let l,c=t=>t;customElements.define("foxy-internal-email-template-form-async-action",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return r(r({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,e="fail"===t?"error":"";return o(l||(l=c` <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),`${this.theme} ${null!=e?e:""}`.trim(),"busy"===t||this.disabled,this.__submit,t)}async __submit(){var t,e;if("busy"!==this.__state)try{this.__state="busy";const r=new a.API(this),s=await r.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=s.ok?"idle":"fail",s.ok&&(null===(e=this.nucleon)||void 0===e||e.refresh())}catch(t){this.__state="fail"}}});let h,m=t=>t;const d=n(e,"email-template-form");class f extends d{constructor(){super(...arguments),this.defaultSubject=null,this.__templateLanguageOptions=[{rawLabel:"Nunjucks",value:"nunjucks"},{rawLabel:"Handlebars",value:"handlebars"},{rawLabel:"Pug",value:"pug"},{rawLabel:"Twig",value:"twig"},{rawLabel:"EJS",value:"ejs"}],this.__toggleGetValue=()=>!!this.form.subject,this.__toggleSetValue=t=>{var e;t?this.edit({subject:null!==(e=this.defaultSubject)&&void 0!==e?e:this.t("general.subject.default_value")}):this.edit({subject:""})}}static get properties(){return r(r({},super.properties),{},{defaultSubject:{attribute:"default-subject"}})}get readonlySelector(){const t=[super.readonlySelector.toString()],e=this.form.subject;return this.form.content_html_url&&e&&t.unshift("content-html"),this.form.content_text_url&&e&&t.unshift("content-text"),new s(t.join(" ").trim())}get disabledSelector(){const t=[super.disabledSelector.toString()];return this.in({idle:{snapshot:"clean"}})&&this.data.content_html_url&&this.data.content_text_url||t.unshift("html-source:cache","text-source:cache"),this.form.subject||t.unshift("general:template-language","html-source","text-source","content-html","content-text"),new s(t.join(" ").trim())}get hiddenSelector(){var t,e,r;const a=[super.hiddenSelector.toString()];return(null===(t=this.data)||void 0===t?void 0:t.content_html_url)||a.unshift("html-source:cache"),(null===(e=this.data)||void 0===e?void 0:e.content_text_url)||a.unshift("text-source:cache"),(null===(r=this.data)||void 0===r?void 0:r.subject)||this.form.subject||a.unshift("general:template-language","general:subject","html-source","text-source","content-html","content-text"),new s(a.join(" ").trim())}renderBody(){var t,e;return o(h||(h=m` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="subject"> </foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="template-language" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> ${0} <foxy-internal-source-control infer="content-html"></foxy-internal-source-control> <foxy-internal-summary-control infer="html-source"> <foxy-internal-text-control layout="summary-item" infer="content-html-url"> </foxy-internal-text-control> <foxy-internal-email-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-email-template-form-async-action> </foxy-internal-summary-control> <foxy-internal-source-control infer="content-text"></foxy-internal-source-control> <foxy-internal-summary-control infer="text-source"> <foxy-internal-text-control layout="summary-item" infer="content-text-url"> </foxy-internal-text-control> <foxy-internal-email-template-form-async-action theme="tertiary-inline" infer="cache" href="${0}"> </foxy-internal-email-template-form-async-action> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.__toggleGetValue,this.__toggleSetValue,this.__templateLanguageOptions,this.renderTemplateOrSlot(),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:cache"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href),super.renderBody())}async _sendPost(t){const e=await super._sendPost(t);if(t.content_html_url&&t.content_text_url){const t=e._links["fx:cache"].href;if(!(await new f.API(this).fetch(t,{method:"POST"})).ok)throw["error:failed_to_cache"]}return await this._fetch(e._links.self.href)}async _sendPatch(t){const e=await super._sendPatch(t);if(!t.content_html_url&&!t.content_text_url)return e;const r=e._links["fx:cache"].href;if(!(await new f.API(this).fetch(r,{method:"POST"})).ok)throw["error:failed_to_cache"];return await this._fetch(e._links.self.href)}}customElements.define("foxy-email-template-form",f);export{f as EmailTemplateForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-a72df5aa.js";import"./shared-0782fee5.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-fda02728.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-fefaece7.js";import{T as
|
|
1
|
+
import"./shared-a72df5aa.js";import"./shared-0782fee5.js";import"./shared-0564def4.js";import"./shared-6aa8f7ee.js";import"./shared-fda02728.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-nucleon-element.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-fefaece7.js";import{T as i}from"./shared-8874ec69.js";import{i as a}from"./shared-53e42a77.js";import{h as d}from"./shared-ba5c42c7.js";import"./shared-f0afd1ee.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./foxy-copy-to-clipboard.js";import"./shared-56f7db6f.js";import"./shared-00b50480.js";import"./shared-4558cdb4.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-7e9fdf64.js";import"./shared-4e709717.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-d1dfac4d.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5cea7ef0.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-05ed8288.js";import"./shared-6524d421.js";import"./shared-df76d498.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";let n,l=e=>e;const m=s(e,"gift-card-code-form");class c extends m{constructor(){super(...arguments),this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__customerGetValue=()=>{var e,r,t;const o=null===(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:customer"])||void 0===t?void 0:t.href,s=this.form.customer_id;return void 0===s?o:this.getCustomerHref(s)},this.__customerSetValue=e=>{const r=o(e);this.edit({customer_id:"number"==typeof r?r:""})},this.__customerFilters=[{type:i.String,path:"id",label:"filters.id"},{type:i.String,path:"tax_id",label:"filters.tax_id"},{type:i.String,path:"email",label:"filters.email"},{type:i.String,path:"first_name",label:"filters.first_name"},{type:i.String,path:"last_name",label:"filters.last_name"},{type:i.Boolean,path:"is_anonymous",label:"filters.is_anonymous",list:[{label:"filters.is_anonymous_true",value:"true"},{label:"filters.is_anonymous_false",value:"false"}]},{type:i.Date,path:"last_login_date",label:"filters.last_login_date"},{type:i.Date,path:"date_created",label:"filters.date_created"},{type:i.Date,path:"date_modified",label:"filters.date_modified"}],this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getCustomerHref:{attribute:!1}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>!e||e.length<=50||"code:v8n_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code:v8n_has_spaces",({current_balance:e})=>"number"==typeof e||"current-balance:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString(),"cart-item"];return new t(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.href||e.push("customer","cart-item","logs"),new t(e.join(" ").trim())}renderBody(){var e,r,t,o,s,i,m,c;let f;try{const o=new URL(null!==(t=null===(r=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===r?void 0:r["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==t?t:"");o.searchParams.set("zoom","item_options"),f=o.toString()}catch(e){f=void 0}return d(n||(n=l` ${0} <foxy-internal-summary-control infer="settings"> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="current-balance"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-resource-picker-control infer="customer" first="${0}" item="foxy-customer-card" .getValue="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="cart-item" item="foxy-item-card" .getValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-async-list-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card"> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),a(null===(s=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===s?void 0:s._links["fx:customers"].href),this.__customerGetValue,this.__customerSetValue,this.__customerFilters,(()=>f),a(null===(m=null===(i=this.data)||void 0===i?void 0:i._links)||void 0===m?void 0:m["fx:gift_card_code_logs"].href),super.renderBody(),a(null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-code-form",c);export{c as GiftCardCodeForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import"./shared-0782fee5.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{T as i}from"./shared-8874ec69.js";import{h as o}from"./shared-ba5c42c7.js";import{R as a,a as s}from"./shared-fefaece7.js";import{i as n}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-4e709717.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-swipe-actions.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-a72df5aa.js";import"./shared-fda02728.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./shared-1c6a1571.js";const d=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let l,c,f=e=>e;const m=a(s(e,"gift-card-form"));class p extends m{constructor(){var e;super(...arguments),e=this,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__provisioningMaxBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_max},this.__provisioningMaxBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:i>e?e:i,initial_balance_max:e}})},this.__provisioningMinBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_min},this.__provisioningMinBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:i<e?e:i}})},this.__provisioningToggleValueGetter=()=>{var e;return!!(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)},this.__provisioningToggleValueSetter=e=>{var r,t,i,o;e?this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:0,initial_balance_max:null!==(o=null===(i=this.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==o?o:0}}):this.edit({provisioning_config:null})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:r})=>"block"===r?`-${e}`:e)).filter(((e,r,t)=>!!e&&t.indexOf(e)===r)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:i.String},{label:"current_balance",path:"current_balance",type:i.Number},{label:"end_date",path:"end_date",type:i.Date},{label:"date_created",path:"date_created",type:i.Date},{label:"date_modified",path:"date_modified",type:i.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(r){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(r.code),e.__codesActions[0].state="end"}catch(r){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return r(r({},super.properties),{},{getCustomerHref:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var r;if(null===(r=e.provisioning_config)||void 0===r?void 0:r.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_min;return!("number"==typeof t&&t<0)||"min-balance:v8n_negative"},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_max;return!("number"==typeof t&&t<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){var e;const r=[super.hiddenSelector.toString()];return this.data||r.push("codes","category-restrictions","attributes"),(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)||r.push("provisioning:sku","provisioning:min-balance","provisioning:max-balance"),new t(r.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return o(l||(l=f` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,r,t,i,a,s,l,m,p,u;let _;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==r?r:"");t.searchParams.set("order","date_created desc"),_=t.toString()}catch(e){_=void 0}return o(c||(c=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" layout="summary-item" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" layout="summary-item" infer="expires"> </foxy-internal-frequency-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="provisioning"> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="sku"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="min-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="max-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,d.map((e=>({label:this.t(`general.currency.code_${e}`),value:e}))),this.__provisioningToggleValueGetter,this.__provisioningToggleValueSetter,n(null===(t=this.form.currency_code)||void 0===t?void 0:t.toUpperCase()),this.__provisioningMinBalanceValueGetter,this.__provisioningMinBalanceValueSetter,n(null===(i=this.form.currency_code)||void 0===i?void 0:i.toUpperCase()),this.__provisioningMaxBalanceValueGetter,this.__provisioningMaxBalanceValueSetter,_,{".getCustomerHref":this.getCustomerHref},this.__codesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],n(null===(s=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===s?void 0:s._links["fx:item_categories"].href),n(null===(l=this.data)||void 0===l?void 0:l._links["fx:gift_card_item_categories"].href),n(null===(m=this.data)||void 0===m?void 0:m._links.self.href),n(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),super.renderBody(),n(null===(u=this.data)||void 0===u?void 0:u._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",p);export{p as GiftCardForm};
|
|
1
|
+
import"./shared-6660c6df.js";import"./shared-8f6400d9.js";import"./shared-1fcf3749.js";import"./shared-0782fee5.js";import"./shared-e1b97b27.js";import"./shared-0564def4.js";import"./shared-c5fa5c92.js";import"./shared-70bd1896.js";import"./shared-6aa8f7ee.js";import"./shared-b293a928.js";import{I as e}from"./shared-edb68eb7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-gift-card-code-card.js";import"./foxy-gift-card-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{T as i}from"./shared-8874ec69.js";import{h as o}from"./shared-ba5c42c7.js";import{R as s,a}from"./shared-fefaece7.js";import{i as n}from"./shared-53e42a77.js";import"./shared-5cea7ef0.js";import"./shared-256fe764.js";import"./shared-944dc1e2.js";import"./shared-00cd0e86.js";import"./shared-f0afd1ee.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-00b50480.js";import"./shared-b7889b37.js";import"./shared-bb43f0ad.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-pagination.js";import"./shared-4e709717.js";import"./foxy-form-dialog.js";import"./shared-a208ae8c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-d0aed1c1.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./foxy-swipe-actions.js";import"./shared-a63c89a1.js";import"./shared-4215bff2.js";import"./shared-355ef444.js";import"./shared-a3f1420c.js";import"./shared-c3fd2e9c.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-b4b9735c.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-b15d45b1.js";import"./shared-e4159eb9.js";import"./shared-0c61b5ce.js";import"./shared-47962c3f.js";import"./shared-a72df5aa.js";import"./shared-fda02728.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-6042ee79.js";import"./shared-641786b2.js";import"./shared-1c6a1571.js";const d=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let l,c,f=e=>e;const m=s(a(e,"gift-card-form"));class p extends m{constructor(){var e;super(...arguments),e=this,this.getCustomerHref=e=>`https://api.foxycart.com/customers/${e}`,this.__provisioningMaxBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_max},this.__provisioningMaxBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:i>e?e:i,initial_balance_max:e}})},this.__provisioningMinBalanceValueGetter=()=>{var e;return null===(e=this.form.provisioning_config)||void 0===e?void 0:e.initial_balance_min},this.__provisioningMinBalanceValueSetter=e=>{var r,t;const i=null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_max)&&void 0!==t?t:e;this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:i<e?e:i}})},this.__provisioningToggleValueGetter=()=>{var e;return!!(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)},this.__provisioningToggleValueSetter=e=>{var r,t,i,o;e?this.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(t=null===(r=this.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==t?t:0,initial_balance_max:null!==(o=null===(i=this.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==o?o:0}}):this.edit({provisioning_config:null})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:r})=>"block"===r?`-${e}`:e)).filter(((e,r,t)=>!!e&&t.indexOf(e)===r)).join(",")})},this.__currencyCodeGetValue=()=>{var e;return null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase()},this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:i.String},{label:"current_balance",path:"current_balance",type:i.Number},{label:"end_date",path:"end_date",type:i.Date},{label:"date_created",path:"date_created",type:i.Date},{label:"date_modified",path:"date_modified",type:i.Date}],this.__codesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(r){e.__codesActions[0].state="busy",e.__codesActions=[...e.__codesActions];try{await navigator.clipboard.writeText(r.code),e.__codesActions[0].state="end"}catch(r){e.__codesActions[0].state="error"}finally{e.__codesActions=[...e.__codesActions],setTimeout((()=>{e.__codesActions[0].state="idle",e.__codesActions=[...e.__codesActions]}),1e3)}}}]}static get properties(){return r(r({},super.properties),{},{getCustomerHref:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",e=>{var r;if(null===(r=e.provisioning_config)||void 0===r?void 0:r.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_min;return!("number"==typeof t&&t<0)||"min-balance:v8n_negative"},e=>{var r;const t=null===(r=e.provisioning_config)||void 0===r?void 0:r.initial_balance_max;return!("number"==typeof t&&t<0)||"max-balance:v8n_negative"},({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long"]}get hiddenSelector(){var e;const r=[super.hiddenSelector.toString()];return this.data||r.push("codes","category-restrictions","attributes"),(null===(e=this.form.provisioning_config)||void 0===e?void 0:e.allow_autoprovisioning)||r.push("provisioning:sku","provisioning:min-balance","provisioning:max-balance"),new t(r.join(" ").trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeaderActions(e){return o(l||(l=f` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-gift-card-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:gift_card_codes"].href],e._links["fx:gift_card_codes"].href,[e._links["fx:gift_card_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,r,t,i,s,a,l,m,p,u;let _;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_codes"].href)&&void 0!==r?r:"");t.searchParams.set("order","date_created desc"),_=t.toString()}catch(e){_=void 0}return o(c||(c=f` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"> </foxy-internal-text-control> <foxy-internal-select-control property="currency_code" layout="summary-item" infer="currency" .getValue="${0}" .options="${0}"> </foxy-internal-select-control> <foxy-internal-frequency-control property="expires_after" layout="summary-item" infer="expires"> </foxy-internal-frequency-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="provisioning"> <foxy-internal-switch-control infer="toggle" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> <foxy-internal-text-control layout="summary-item" infer="sku"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="min-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="max-balance" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="codes" item="foxy-gift-card-code-card" form="foxy-gift-card-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="gift_card_uri" options-href="${0}" links-href="${0}" embed-key="fx:gift_card_item_categories" own-uri="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.__currencyCodeGetValue,d.map((e=>({label:this.t(`general.currency.code_${e}`),value:e}))),this.__provisioningToggleValueGetter,this.__provisioningToggleValueSetter,n(null===(t=this.form.currency_code)||void 0===t?void 0:t.toUpperCase()),this.__provisioningMinBalanceValueGetter,this.__provisioningMinBalanceValueSetter,n(null===(i=this.form.currency_code)||void 0===i?void 0:i.toUpperCase()),this.__provisioningMaxBalanceValueGetter,this.__provisioningMaxBalanceValueSetter,_,{".getCustomerHref":this.getCustomerHref},this.__codesActions,this.__codesFilters,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],n(null===(a=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===a?void 0:a._links["fx:item_categories"].href),n(null===(l=this.data)||void 0===l?void 0:l._links["fx:gift_card_item_categories"].href),n(null===(m=this.data)||void 0===m?void 0:m._links.self.href),n(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),super.renderBody(),n(null===(u=this.data)||void 0===u?void 0:u._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-gift-card-form",p);export{p as GiftCardForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./shared-ba5c42c7.js";import{F as t}from"./shared-343d1fd7.js";import{aM as a,aH as s,_ as n}from"./shared-d1195c27.js";import{A as r}from"./shared-7e9fdf64.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=await o(m(l(p))),c=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(m(a.toString()));if(e.push(...s._embedded["fx:payment_methods"]),s._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(t=f._links["fx:payment_gateway"])||void 0===t?void 0:t.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentMethods:n,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${s}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=n.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:w,paymentMethods:await c,base:new URL(d.url).origin});n=JSON.stringify(_),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,fraudProtections:a,base:s}=e,n=new URL(`./payment_presets/${t}/available_fraud_protections`,s),r={minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"",default_value:""},{id:"private_key",name:"Secret Key",type:"text",optional:!0,description:"",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:n.toString()}},values:r}}async function d(e){let t,s;try{const{request:n,fetch:r}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const i=a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(n.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(r(a.toString()));if(e.push(...s._embedded["fx:fraud_protections"]),s._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(n.url).origin});s=JSON.stringify(m),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=s(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),w=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function u(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(_)))]);if("GET"===f.method){const e=parseInt(null!==(t=w.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),u=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(y)),_.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return c(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=c({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=s(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),w=new URL(o.self.href);return u.search=w.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,w=u.startsWith("H"),_=d(f),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===c)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=function(e){const t=[[a(/\/payment_presets\/(.+?)\/payment_methods\/(.+?)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+?)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+?)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+?)\/fraud_protections\/(.+?)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+?)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+?)\/payment_methods/,{presetId:1}),u],[a(/\/payment_presets\/(.+?)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(m),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|
|
1
|
+
import{L as e}from"./shared-ba5c42c7.js";import{F as t}from"./shared-343d1fd7.js";import{aM as a,aH as s,_ as n}from"./shared-d1195c27.js";import{A as r}from"./shared-7e9fdf64.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=await o(m(l(p))),c=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(m(a.toString()));if(e.push(...s._embedded["fx:payment_methods"]),s._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(t=f._links["fx:payment_gateway"])||void 0===t?void 0:t.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentMethods:n,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${s}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=n.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:w,paymentMethods:await c,base:new URL(d.url).origin});n=JSON.stringify(_),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,fraudProtections:a,base:s}=e,n=new URL(`./payment_presets/${t}/available_fraud_protections`,s),r={minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"",default_value:""},{id:"private_key",name:"Secret Key",type:"text",optional:!0,description:"",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:n.toString()}},values:r}}async function d(e){let t,s;try{const{request:n,fetch:r}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const i=a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(n.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(r(a.toString()));if(e.push(...s._embedded["fx:fraud_protections"]),s._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(n.url).origin});s=JSON.stringify(m),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=s(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),w=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function u(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(_)))]);if("GET"===f.method){const e=parseInt(null!==(t=w.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),u=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(y)),_.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return c(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=c({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=s(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),w=new URL(o.self.href);return u.search=w.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,w=u.startsWith("H"),_=d(f),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===c)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=function(e){const t=[[a(/\/payment_presets\/(.+?)\/payment_methods\/(.+?)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+?)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+?)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+?)\/fraud_protections\/(.+?)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+?)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+?)\/payment_methods/,{presetId:1}),u],[a(/\/payment_presets\/(.+?)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(b),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import"./shared-0782fee5.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import{b as e,I as t}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-a208ae8c.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-ba5c42c7.js";import{N as n}from"./shared-d1dfac4d.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-fefaece7.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-b7889b37.js";import"./shared-00b50480.js";import"./shared-944dc1e2.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1c6a1571.js";import"./shared-256fe764.js";import"./shared-00cd0e86.js";import"./shared-c3fd2e9c.js";import"./shared-b15d45b1.js";import"./shared-5fd5805c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-31b98ac2.js";import"./shared-5cea7ef0.js";import"./shared-e4159eb9.js";import"./shared-641786b2.js";import"./shared-cf613436.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-4215bff2.js";import"./shared-a3f1420c.js";import"./shared-355ef444.js";import"./shared-c5fa5c92.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-6042ee79.js";import"./shared-a72df5aa.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-fda02728.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,$,k=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,o,i,s,n,a,d,l,c;return r(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r($||($=k` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}});let S,P,A,C,H,L,E,I,R,B,q=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(S||(S=q``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(P||(P=q` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(A||(A=q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(C||(C=q` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(H||(H=q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(L||(L=q` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(E||(E=q` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=q` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(R||(R=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(B||(B=q` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let G,T,U,Z=e=>e;const M=c(u(t,"transaction"));class O extends M{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new O.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{O.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(G||(G=Z` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_,y;let v,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),v=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return r(T||(T=Z` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(s=null===(i=this.data)||void 0===i?void 0:i.status)&&void 0!==s?s:"")?r(U||(U=Z` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),d(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},d(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),d(null===(m=this.data)||void 0===m?void 0:m._links["fx:attributes"].href),d(v),d(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(_=null===(h=this.data)||void 0===h?void 0:h._links["fx:process_webhook"])||void 0===_?void 0:_.href),d(null===(y=this.data)||void 0===y?void 0:y._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",O);export{O as Transaction};
|
|
1
|
+
import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-bb43f0ad.js";import"./shared-0782fee5.js";import"./shared-0564def4.js";import"./shared-70bd1896.js";import{b as e,I as t}from"./shared-edb68eb7.js";import"./shared-f0afd1ee.js";import"./shared-a208ae8c.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-ba5c42c7.js";import{N as n}from"./shared-d1dfac4d.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-fefaece7.js";import"./shared-47962c3f.js";import"./shared-0c61b5ce.js";import"./shared-b7889b37.js";import"./shared-00b50480.js";import"./shared-944dc1e2.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-1c6a1571.js";import"./shared-256fe764.js";import"./shared-00cd0e86.js";import"./shared-c3fd2e9c.js";import"./shared-b15d45b1.js";import"./shared-5fd5805c.js";import"./shared-e14bc410.js";import"./shared-56f7db6f.js";import"./shared-4558cdb4.js";import"./shared-31b98ac2.js";import"./shared-5cea7ef0.js";import"./shared-e4159eb9.js";import"./shared-641786b2.js";import"./shared-cf613436.js";import"./shared-7ab454fb.js";import"./shared-82614ac9.js";import"./shared-4215bff2.js";import"./shared-a3f1420c.js";import"./shared-355ef444.js";import"./shared-c5fa5c92.js";import"./shared-b4b9735c.js";import"./shared-188a9c2e.js";import"./shared-421b13a8.js";import"./shared-15ded782.js";import"./shared-6524d421.js";import"./shared-651c44fa.js";import"./shared-c2ca5bee.js";import"./shared-75908858.js";import"./shared-b293a928.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-6042ee79.js";import"./shared-a72df5aa.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-e1b97b27.js";import"./shared-a63c89a1.js";import"./shared-cf8e2611.js";import"./shared-cb2a2e33.js";import"./shared-6aa8f7ee.js";import"./shared-fda02728.js";import"./shared-05ed8288.js";import"./shared-df76d498.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,k,$,S=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,o,i,s,n,a,d,l,c,u,f;return r(x||(x=S` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"",(null===(f=null===(u=this.nucleon)||void 0===u?void 0:u.data)||void 0===f?void 0:f._links["fx:receipt"])?this.__renderReceiptAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=S` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=S` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=S` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=S` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r(k||(k=S` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}__renderReceiptAction(){var e,t;const o=this.nucleon;return r($||($=S` <a target="_blank" class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="receipt" key="caption"></foxy-i18n> </a> `),d(null===(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}});let P,A,C,H,L,E,R,I,B,q,G=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(P||(P=G``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(A||(A=G` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(C||(C=G` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(H||(H=G` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(L||(L=G` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(E||(E=G` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(R||(R=G` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=G` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(B||(B=G` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(q||(q=G` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let T,U,Z,M=e=>e;const O=c(u(t,"transaction"));class W extends O{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new W.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{W.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(T||(T=M` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_,y;let v,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),v=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return r(U||(U=M` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(s=null===(i=this.data)||void 0===i?void 0:i.status)&&void 0!==s?s:"")?r(Z||(Z=M` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),d(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},d(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),d(null===(m=this.data)||void 0===m?void 0:m._links["fx:attributes"].href),d(v),d(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(_=null===(h=this.data)||void 0===h?void 0:h._links["fx:process_webhook"])||void 0===_?void 0:_.href),d(null===(y=this.data)||void 0===y?void 0:y._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",W);export{W as Transaction};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TemplateResult } from 'lit-element';
|
|
1
|
+
import type { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import type { Data } from './types';
|
|
3
3
|
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
4
4
|
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
@@ -12,6 +12,9 @@ declare const Base: typeof InternalForm & import("lit-element").Constructor<impo
|
|
|
12
12
|
* @since 1.14.0
|
|
13
13
|
*/
|
|
14
14
|
export declare class EmailTemplateForm extends Base<Data> {
|
|
15
|
+
static get properties(): PropertyDeclarations;
|
|
16
|
+
/** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */
|
|
17
|
+
defaultSubject: string | null;
|
|
15
18
|
private readonly __templateLanguageOptions;
|
|
16
19
|
private readonly __toggleGetValue;
|
|
17
20
|
private readonly __toggleSetValue;
|
|
@@ -14,6 +14,8 @@ const Base = TranslatableMixin(InternalForm, NS);
|
|
|
14
14
|
export class EmailTemplateForm extends Base {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
+
/** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */
|
|
18
|
+
this.defaultSubject = null;
|
|
17
19
|
this.__templateLanguageOptions = [
|
|
18
20
|
{ rawLabel: 'Nunjucks', value: 'nunjucks' },
|
|
19
21
|
{ rawLabel: 'Handlebars', value: 'handlebars' },
|
|
@@ -23,7 +25,19 @@ export class EmailTemplateForm extends Base {
|
|
|
23
25
|
];
|
|
24
26
|
this.__toggleGetValue = () => !!this.form.subject;
|
|
25
27
|
this.__toggleSetValue = (newValue) => {
|
|
26
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
if (newValue) {
|
|
30
|
+
this.edit({ subject: (_a = this.defaultSubject) !== null && _a !== void 0 ? _a : this.t('general.subject.default_value') });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.edit({ subject: '' });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get properties() {
|
|
38
|
+
return {
|
|
39
|
+
...super.properties,
|
|
40
|
+
defaultSubject: { attribute: 'default-subject' },
|
|
27
41
|
};
|
|
28
42
|
}
|
|
29
43
|
get readonlySelector() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,i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IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QAEpE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAElD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-element';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'email-template-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n private readonly __templateLanguageOptions = [\n { rawLabel: 'Nunjucks', value: 'nunjucks' },\n { rawLabel: 'Handlebars', value: 'handlebars' },\n { rawLabel: 'Pug', value: 'pug' },\n { rawLabel: 'Twig', value: 'twig' },\n { rawLabel: 'EJS', value: 'ejs' },\n ];\n\n private readonly __toggleGetValue = () => !!this.form.subject;\n\n private readonly __toggleSetValue = (newValue: boolean) => {\n this.edit({ subject: newValue ? this.t('general.subject.default_value') : '' });\n };\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n const subject = this.form.subject;\n\n if (this.form.content_html_url && subject) alwaysMatch.unshift('content-html');\n if (this.form.content_text_url && subject) alwaysMatch.unshift('content-text');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get disabledSelector(): BooleanSelector {\n const alwaysMatch = [super.disabledSelector.toString()];\n\n if (\n !this.in({ idle: { snapshot: 'clean' } }) ||\n !this.data.content_html_url ||\n !this.data.content_text_url\n ) {\n alwaysMatch.unshift('html-source:cache', 'text-source:cache');\n }\n\n if (!this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data?.content_html_url) alwaysMatch.unshift('html-source:cache');\n if (!this.data?.content_text_url) alwaysMatch.unshift('text-source:cache');\n if (!this.data?.subject && !this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'general:subject',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n infer=\"toggle\"\n .getValue=${this.__toggleGetValue}\n .setValue=${this.__toggleSetValue}\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"subject\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"template-language\"\n .options=${this.__templateLanguageOptions}\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-source-control infer=\"content-html\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"html-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-html-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control infer=\"content-text\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"text-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-text-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPost(edits);\n\n if (edits.content_html_url && edits.content_text_url) {\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n }\n\n return await this._fetch(data._links.self.href);\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPatch(edits);\n if (!edits.content_html_url && !edits.content_text_url) return data;\n\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n\n return await this._fetch(data._links.self.href);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EmailTemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/EmailTemplateForm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MA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AAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;SACnD;QAED,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,KAAoB;QAC7C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QAEpE,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAElD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'email-template-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing email templates (`fx:email_template`).\n *\n * @element foxy-email-template-form\n * @since 1.14.0\n */\nexport class EmailTemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n defaultSubject: { attribute: 'default-subject' },\n };\n }\n\n /** Default email subject. Use this instead of i18next key when you need to use handlebars syntax. */\n defaultSubject: string | null = null;\n\n private readonly __templateLanguageOptions = [\n { rawLabel: 'Nunjucks', value: 'nunjucks' },\n { rawLabel: 'Handlebars', value: 'handlebars' },\n { rawLabel: 'Pug', value: 'pug' },\n { rawLabel: 'Twig', value: 'twig' },\n { rawLabel: 'EJS', value: 'ejs' },\n ];\n\n private readonly __toggleGetValue = () => !!this.form.subject;\n\n private readonly __toggleSetValue = (newValue: boolean) => {\n if (newValue) {\n this.edit({ subject: this.defaultSubject ?? this.t('general.subject.default_value') });\n } else {\n this.edit({ subject: '' });\n }\n };\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n const subject = this.form.subject;\n\n if (this.form.content_html_url && subject) alwaysMatch.unshift('content-html');\n if (this.form.content_text_url && subject) alwaysMatch.unshift('content-text');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get disabledSelector(): BooleanSelector {\n const alwaysMatch = [super.disabledSelector.toString()];\n\n if (\n !this.in({ idle: { snapshot: 'clean' } }) ||\n !this.data.content_html_url ||\n !this.data.content_text_url\n ) {\n alwaysMatch.unshift('html-source:cache', 'text-source:cache');\n }\n\n if (!this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data?.content_html_url) alwaysMatch.unshift('html-source:cache');\n if (!this.data?.content_text_url) alwaysMatch.unshift('text-source:cache');\n if (!this.data?.subject && !this.form.subject) {\n alwaysMatch.unshift(\n 'general:template-language',\n 'general:subject',\n 'html-source',\n 'text-source',\n 'content-html',\n 'content-text'\n );\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n infer=\"toggle\"\n .getValue=${this.__toggleGetValue}\n .setValue=${this.__toggleSetValue}\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"subject\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"template-language\"\n .options=${this.__templateLanguageOptions}\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-source-control infer=\"content-html\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"html-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-html-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control infer=\"content-text\"></foxy-internal-source-control>\n\n <foxy-internal-summary-control infer=\"text-source\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"content-text-url\">\n </foxy-internal-text-control>\n <foxy-internal-email-template-form-async-action\n theme=\"tertiary-inline\"\n infer=\"cache\"\n href=${ifDefined(this.data?._links['fx:cache'].href)}\n >\n </foxy-internal-email-template-form-async-action>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPost(edits);\n\n if (edits.content_html_url && edits.content_text_url) {\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n }\n\n return await this._fetch(data._links.self.href);\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n const data = await super._sendPatch(edits);\n if (!edits.content_html_url && !edits.content_text_url) return data;\n\n const url = data._links['fx:cache'].href;\n const response = await new EmailTemplateForm.API(this).fetch(url, { method: 'POST' });\n if (!response.ok) throw ['error:failed_to_cache'];\n\n return await this._fetch(data._links.self.href);\n }\n}\n"]}
|
|
@@ -92,7 +92,7 @@ export class GiftCardCodeForm extends Base {
|
|
|
92
92
|
<foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control>
|
|
93
93
|
<foxy-internal-number-control layout="summary-item" infer="current-balance">
|
|
94
94
|
</foxy-internal-number-control>
|
|
95
|
-
<foxy-internal-date-control layout="summary-item" infer="end-date">
|
|
95
|
+
<foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date">
|
|
96
96
|
</foxy-internal-date-control>
|
|
97
97
|
</foxy-internal-summary-control>
|
|
98
98
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftCardCodeForm.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardCodeForm/GiftCardCodeForm.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAU,IAAI,EAAE,iCAA8B;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAU;IAAhD;;QAiBE,8DAA8D;QAC9D,oBAAe,GAAoC,EAAE,CAAC,EAAE;YACtD,OAAO,sC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,EAAE;;;;eAIX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { Data } from './types';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { Option, Type } from '../QueryBuilder/types';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'gift-card-code-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing gift card codes (`fx:gift_card_code`).\n *\n * @element foxy-gift-card-code-form\n * @since 1.15.0\n */\nexport class GiftCardCodeForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getCustomerHref: { attribute: false },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => !v || v.length <= 50 || 'code:v8n_too_long',\n ({ code: v }) => !v?.includes(' ') || 'code:v8n_has_spaces',\n ({ current_balance: v }) => typeof v === 'number' || 'current-balance:v8n_required',\n ];\n }\n\n /** Returns a `fx:customer` Resource URL for a Customer ID. */\n getCustomerHref: (id: number | string) => string = id => {\n return `https://api.foxycart.com/customers/${id}`;\n };\n\n private readonly __customerGetValue = () => {\n const link = this.data?._links?.['fx:customer']?.href;\n const id = this.form.customer_id;\n return id === undefined ? link : this.getCustomerHref(id);\n };\n\n private readonly __customerSetValue = (v: string) => {\n const id = getResourceId(v);\n this.edit({ customer_id: typeof id === 'number' ? id : '' });\n };\n\n private readonly __customerFilters: Option[] = [\n { type: Type.String, path: 'id', label: 'filters.id' },\n { type: Type.String, path: 'tax_id', label: 'filters.tax_id' },\n { type: Type.String, path: 'email', label: 'filters.email' },\n { type: Type.String, path: 'first_name', label: 'filters.first_name' },\n { type: Type.String, path: 'last_name', label: 'filters.last_name' },\n {\n type: Type.Boolean,\n path: 'is_anonymous',\n label: 'filters.is_anonymous',\n list: [\n { label: 'filters.is_anonymous_true', value: 'true' },\n { label: 'filters.is_anonymous_false', value: 'false' },\n ],\n },\n { type: Type.Date, path: 'last_login_date', label: 'filters.last_login_date' },\n { type: Type.Date, path: 'date_created', label: 'filters.date_created' },\n { type: Type.Date, path: 'date_modified', label: 'filters.date_modified' },\n ];\n\n private readonly __storeLoaderId = 'storeLoader';\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString(), 'cart-item'];\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n if (!this.href) alwaysMatch.push('customer', 'cart-item', 'logs');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n let href: string | undefined;\n\n try {\n const url = new URL(\n this.data?._links?.['fx:provisioned_by_transaction_detail_id'].href ?? ''\n );\n url.searchParams.set('zoom', 'item_options');\n href = url.toString();\n } catch {\n href = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"settings\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"code\"></foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"current-balance\">\n </foxy-internal-number-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-resource-picker-control\n infer=\"customer\"\n first=${ifDefined(this.__storeLoader?.data?._links['fx:customers'].href)}\n item=\"foxy-customer-card\"\n .getValue=${this.__customerGetValue}\n .setValue=${this.__customerSetValue}\n .filters=${this.__customerFilters}\n >\n </foxy-internal-resource-picker-control>\n\n <foxy-internal-resource-picker-control\n infer=\"cart-item\"\n item=\"foxy-item-card\"\n .getValue=${() => href}\n >\n </foxy-internal-resource-picker-control>\n\n <foxy-internal-async-list-control\n infer=\"logs\"\n first=${ifDefined(this.data?._links?.['fx:gift_card_code_logs'].href)}\n limit=\"5\"\n item=\"foxy-gift-card-code-log-card\"\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GiftCardCodeForm.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardCodeForm/GiftCardCodeForm.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAU,IAAI,EAAE,iCAA8B;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,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;;;;;oBAOrB,GAAG,EAAE,CAAC,IAAI;;;;;;gBAMd,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,wBAAwB,EAAE,IAAI,CAAC;;;;;;QAMrE,KAAK,CAAC,UAAU,EAAE;;;;eAIX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { Data } from './types';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { Option, Type } from '../QueryBuilder/types';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'gift-card-code-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for creating or editing gift card codes (`fx:gift_card_code`).\n *\n * @element foxy-gift-card-code-form\n * @since 1.15.0\n */\nexport class GiftCardCodeForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getCustomerHref: { attribute: false },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => !v || v.length <= 50 || 'code:v8n_too_long',\n ({ code: v }) => !v?.includes(' ') || 'code:v8n_has_spaces',\n ({ current_balance: v }) => typeof v === 'number' || 'current-balance:v8n_required',\n ];\n }\n\n /** Returns a `fx:customer` Resource URL for a Customer ID. */\n getCustomerHref: (id: number | string) => string = id => {\n return `https://api.foxycart.com/customers/${id}`;\n };\n\n private readonly __customerGetValue = () => {\n const link = this.data?._links?.['fx:customer']?.href;\n const id = this.form.customer_id;\n return id === undefined ? link : this.getCustomerHref(id);\n };\n\n private readonly __customerSetValue = (v: string) => {\n const id = getResourceId(v);\n this.edit({ customer_id: typeof id === 'number' ? id : '' });\n };\n\n private readonly __customerFilters: Option[] = [\n { type: Type.String, path: 'id', label: 'filters.id' },\n { type: Type.String, path: 'tax_id', label: 'filters.tax_id' },\n { type: Type.String, path: 'email', label: 'filters.email' },\n { type: Type.String, path: 'first_name', label: 'filters.first_name' },\n { type: Type.String, path: 'last_name', label: 'filters.last_name' },\n {\n type: Type.Boolean,\n path: 'is_anonymous',\n label: 'filters.is_anonymous',\n list: [\n { label: 'filters.is_anonymous_true', value: 'true' },\n { label: 'filters.is_anonymous_false', value: 'false' },\n ],\n },\n { type: Type.Date, path: 'last_login_date', label: 'filters.last_login_date' },\n { type: Type.Date, path: 'date_created', label: 'filters.date_created' },\n { type: Type.Date, path: 'date_modified', label: 'filters.date_modified' },\n ];\n\n private readonly __storeLoaderId = 'storeLoader';\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString(), 'cart-item'];\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n if (!this.href) alwaysMatch.push('customer', 'cart-item', 'logs');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n let href: string | undefined;\n\n try {\n const url = new URL(\n this.data?._links?.['fx:provisioned_by_transaction_detail_id'].href ?? ''\n );\n url.searchParams.set('zoom', 'item_options');\n href = url.toString();\n } catch {\n href = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"settings\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"code\"></foxy-internal-text-control>\n <foxy-internal-number-control layout=\"summary-item\" infer=\"current-balance\">\n </foxy-internal-number-control>\n <foxy-internal-date-control layout=\"summary-item\" format=\"iso-long\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-resource-picker-control\n infer=\"customer\"\n first=${ifDefined(this.__storeLoader?.data?._links['fx:customers'].href)}\n item=\"foxy-customer-card\"\n .getValue=${this.__customerGetValue}\n .setValue=${this.__customerSetValue}\n .filters=${this.__customerFilters}\n >\n </foxy-internal-resource-picker-control>\n\n <foxy-internal-resource-picker-control\n infer=\"cart-item\"\n item=\"foxy-item-card\"\n .getValue=${() => href}\n >\n </foxy-internal-resource-picker-control>\n\n <foxy-internal-async-list-control\n infer=\"logs\"\n first=${ifDefined(this.data?._links?.['fx:gift_card_code_logs'].href)}\n limit=\"5\"\n item=\"foxy-gift-card-code-log-card\"\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
|
|
@@ -6,6 +6,8 @@ import '../../internal/InternalDateControl/index';
|
|
|
6
6
|
import '../../internal/InternalTextControl/index';
|
|
7
7
|
import '../../internal/InternalForm/index';
|
|
8
8
|
import '../GiftCardCodeLogCard/index';
|
|
9
|
+
import '../NucleonElement/index';
|
|
9
10
|
import '../CustomerCard/index';
|
|
11
|
+
import '../ItemCard/index';
|
|
10
12
|
import { GiftCardCodeForm } from './GiftCardCodeForm';
|
|
11
13
|
export { GiftCardCodeForm };
|
|
@@ -6,7 +6,9 @@ import "../../internal/InternalDateControl/index.js";
|
|
|
6
6
|
import "../../internal/InternalTextControl/index.js";
|
|
7
7
|
import "../../internal/InternalForm/index.js";
|
|
8
8
|
import "../GiftCardCodeLogCard/index.js";
|
|
9
|
+
import "../NucleonElement/index.js";
|
|
9
10
|
import "../CustomerCard/index.js";
|
|
11
|
+
import "../ItemCard/index.js";
|
|
10
12
|
import { GiftCardCodeForm } from "./GiftCardCodeForm.js";
|
|
11
13
|
customElements.define('foxy-gift-card-code-form', GiftCardCodeForm);
|
|
12
14
|
export { GiftCardCodeForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardCodeForm/index.ts"],"names":[],"mappings":"AAAA,+DAA4D;AAC5D,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,qDAAkD;AAClD,qDAAkD;AAClD,8CAA2C;AAE3C,yCAAsC;AACtC,kCAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardCodeForm/index.ts"],"names":[],"mappings":"AAAA,+DAA4D;AAC5D,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,qDAAkD;AAClD,qDAAkD;AAClD,8CAA2C;AAE3C,yCAAsC;AACtC,oCAAiC;AACjC,kCAA+B;AAC/B,8BAA2B;AAE3B,OAAO,EAAE,gBAAgB,EAAE,8BAA2B;AAEtD,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalResourcePickerControl/index';\nimport '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalNumberControl/index';\nimport '../../internal/InternalDateControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../GiftCardCodeLogCard/index';\nimport '../NucleonElement/index';\nimport '../CustomerCard/index';\nimport '../ItemCard/index';\n\nimport { GiftCardCodeForm } from './GiftCardCodeForm';\n\ncustomElements.define('foxy-gift-card-code-form', GiftCardCodeForm);\n\nexport { GiftCardCodeForm };\n"]}
|
|
@@ -131,7 +131,7 @@ export class PaymentsApi extends LitElement {
|
|
|
131
131
|
paymentMethodSetsUrl,
|
|
132
132
|
fraudProtectionsUrl,
|
|
133
133
|
paymentGatewaysUrl,
|
|
134
|
-
getPaymentMethodSetHostedPaymentGatewayUrl: createGetter(
|
|
134
|
+
getPaymentMethodSetHostedPaymentGatewayUrl: createGetter(paymentMethodSetHostedPaymentGatewayBaseUrl),
|
|
135
135
|
getHostedPaymentGatewayUrl: createGetter(hostedPaymentGatewayBaseUrl),
|
|
136
136
|
getPaymentMethodSetUrl: createGetter(paymentMethodSetBaseUrl),
|
|
137
137
|
getFraudProtectionUrl: createGetter(fraudProtectionBaseUrl),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentsApi.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApi/PaymentsApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,UAAU,EAAE,uBAAoB;AACzC,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IAA3C;;QAwBE;;;WAGG;QACH,gDAA2C,GAAkB,IAAI,CAAC;QAElE;;;WAGG;QACH,6CAAwC,GAAkB,IAAI,CAAC;QAE/D;;;WAGG;QACH,mCAA8B,GAAkB,IAAI,CAAC;QAErD;;;WAGG;QACH,gCAA2B,GAAkB,IAAI,CAAC;QAElD;;;WAGG;QACH,6BAAwB,GAAkB,IAAI,CAAC;QAE/C;;;WAGG;QACH,6BAAwB,GAAkB,IAAI,CAAC;QA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B,EAAE,CAAC;QAC7B,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\n\nimport { LitElement } from 'lit-element';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { getHandler } from './api/index';\nimport { API } from '../NucleonElement/API';\n\n/**\n * Adapter element for Payments API. This element requires an additional hAPI adapter\n * that will handle authentication and session management.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * Payments API elements with hAPI, wrap them into this node._\n *\n * @element foxy-payments-api\n * @since 1.21.0\n */\nexport class PaymentsApi extends LitElement {\n static get properties(): PropertyDeclarations {\n return {\n paymentMethodSetHostedPaymentGatewayBaseUrl: {\n attribute: 'payment-method-set-hosted-payment-gateway-base-url',\n },\n\n paymentMethodSetHostedPaymentGatewaysUrl: {\n attribute: 'payment-method-set-hosted-payment-gateways-url',\n },\n\n hostedPaymentGatewaysHelperUrl: { attribute: 'hosted-payment-gateways-helper-url' },\n hostedPaymentGatewayBaseUrl: { attribute: 'hosted-payment-gateway-base-url' },\n hostedPaymentGatewaysUrl: { attribute: 'hosted-payment-gateways-url' },\n paymentGatewaysHelperUrl: { attribute: 'payment-gateways-helper-url' },\n paymentMethodSetBaseUrl: { attribute: 'payment-method-set-base-url' },\n paymentMethodSetsUrl: { attribute: 'payment-method-sets-url' },\n fraudProtectionBaseUrl: { attribute: 'fraud-protection-base-url' },\n fraudProtectionsUrl: { attribute: 'fraud-protections-url' },\n paymentGatewayBaseUrl: { attribute: 'payment-gateway-base-url' },\n paymentGatewaysUrl: { attribute: 'payment-gateways-url' },\n };\n }\n\n /**\n * Base URL of the `fx:payment_method_set_hosted_payment_gateway` resource (without ID).\n * @example https://api.foxy.io/payment_method_set_hosted_payment_gateways/\n */\n paymentMethodSetHostedPaymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_method_set_hosted_payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/payment_method_set_hosted_payment_gateways\n */\n paymentMethodSetHostedPaymentGatewaysUrl: string | null = null;\n\n /**\n * URL of the `fx:hosted_payment_gateways` property helper.\n * @example https://api.foxy.io/property_helpers/hosted_payment_gateways\n */\n hostedPaymentGatewaysHelperUrl: string | null = null;\n\n /**\n * Base URL of the `fx:hosted_payment_gateway` resource (without ID).\n * @example https://api.foxy.io/hosted_payment_gateways/\n */\n hostedPaymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:hosted_payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/hosted_payment_gateways\n */\n hostedPaymentGatewaysUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_gateways` property helper.\n * @example https://api.foxy.io/property_helpers/payment_gateways\n */\n paymentGatewaysHelperUrl: string | null = null;\n\n /**\n * Base URL of the `fx:payment_method_set` resource (without ID).\n * @example https://api.foxy.io/payment_method_sets/\n */\n paymentMethodSetBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_method_sets` collection.\n * @example https://api.foxy.io/stores/0/payment_method_sets\n */\n paymentMethodSetsUrl: string | null = null;\n\n /**\n * Base URL of the `fx:fraud_protection` resource (without ID).\n * @example https://api.foxy.io/fraud_protections/\n */\n fraudProtectionBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:fraud_protections` collection.\n * @example https://api.foxy.io/stores/0/fraud_protections\n */\n fraudProtectionsUrl: string | null = null;\n\n /**\n * Base URL of the `fx:payment_gateway` resource (without ID).\n * @example https://api.foxy.io/payment_gateways/\n */\n paymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/payment_gateways\n */\n paymentGatewaysUrl: string | null = null;\n\n private readonly __api = new API(this);\n\n private readonly __fetch = this.__api.fetch.bind(this.__api);\n\n private readonly __handleFetch = (evt: Event) => {\n if (!(evt instanceof FetchEvent)) return;\n if (!evt.request.url.startsWith('https://foxy-payments-api.element/')) return;\n if (evt.defaultPrevented) return;\n\n const {\n paymentMethodSetHostedPaymentGatewaysUrl,\n hostedPaymentGatewaysHelperUrl,\n paymentGatewaysHelperUrl,\n hostedPaymentGatewaysUrl,\n paymentMethodSetsUrl,\n fraudProtectionsUrl,\n paymentGatewaysUrl,\n } = this;\n\n const paymentMethodSetHostedPaymentGatewayBaseUrl =\n this.paymentMethodSetHostedPaymentGatewayBaseUrl ??\n this.paymentMethodSetHostedPaymentGatewaysUrl;\n\n const hostedPaymentGatewayBaseUrl =\n this.hostedPaymentGatewayBaseUrl ?? this.hostedPaymentGatewaysUrl;\n\n const paymentMethodSetBaseUrl = this.paymentMethodSetBaseUrl ?? this.paymentMethodSetsUrl;\n const fraudProtectionBaseUrl = this.fraudProtectionBaseUrl ?? this.fraudProtectionsUrl;\n const paymentGatewayBaseUrl = this.paymentGatewayBaseUrl ?? this.paymentGatewaysUrl;\n\n if (paymentMethodSetHostedPaymentGatewaysUrl === null) return;\n if (paymentMethodSetHostedPaymentGatewayBaseUrl === null) return;\n if (hostedPaymentGatewaysHelperUrl === null) return;\n if (paymentGatewaysHelperUrl === null) return;\n if (hostedPaymentGatewaysUrl === null) return;\n if (hostedPaymentGatewayBaseUrl === null) return;\n if (paymentMethodSetsUrl === null) return;\n if (paymentMethodSetBaseUrl === null) return;\n if (fraudProtectionsUrl === null) return;\n if (fraudProtectionBaseUrl === null) return;\n if (paymentGatewaysUrl === null) return;\n if (paymentGatewayBaseUrl === null) return;\n\n const createGetter = (link: string) => (id: string) => {\n const url = new URL(link);\n if (!url.pathname.endsWith('/')) url.pathname += '/';\n url.pathname += id;\n return url.toString();\n };\n\n const handler = getHandler({\n hostedPaymentGatewaysHelperUrl,\n paymentGatewaysHelperUrl,\n hostedPaymentGatewaysUrl,\n paymentMethodSetsUrl,\n fraudProtectionsUrl,\n paymentGatewaysUrl,\n\n getPaymentMethodSetHostedPaymentGatewayUrl: createGetter(\n paymentMethodSetHostedPaymentGatewaysUrl\n ),\n\n getHostedPaymentGatewayUrl: createGetter(hostedPaymentGatewayBaseUrl),\n getPaymentMethodSetUrl: createGetter(paymentMethodSetBaseUrl),\n getFraudProtectionUrl: createGetter(fraudProtectionBaseUrl),\n getPaymentGatewayUrl: createGetter(paymentGatewayBaseUrl),\n\n request: evt.request,\n fetch: this.__fetch,\n });\n\n if (handler) {\n evt.preventDefault();\n evt.respondWith(handler);\n }\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__handleFetch);\n }\n\n createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__handleFetch);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PaymentsApi.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApi/PaymentsApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,UAAU,EAAE,uBAAoB;AACzC,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU;IAA3C;;QAwBE;;;WAGG;QACH,gDAA2C,GAAkB,IAAI,CAAC;QAElE;;;WAGG;QACH,6CAAwC,GAAkB,IAAI,CAAC;QAE/D;;;WAGG;QACH,mCAA8B,GAAkB,IAAI,CAAC;QAErD;;;WAGG;QACH,gCAA2B,GAAkB,IAAI,CAAC;QAElD;;;WAGG;QACH,6BAAwB,GAAkB,IAAI,CAAC;QAE/C;;;WAGG;QACH,6BAAwB,GAAkB,IAAI,CAAC;QAE/C;;;WAGG;QACH,4BAAuB,GAAkB,IAAI,CAAC;QAE9C;;;WAGG;QACH,yBAAoB,GAAkB,IAAI,CAAC;QAE3C;;;WAGG;QACH,2BAAsB,GAAkB,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arations } from 'lit-element';\n\nimport { LitElement } from 'lit-element';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { getHandler } from './api/index';\nimport { API } from '../NucleonElement/API';\n\n/**\n * Adapter element for Payments API. This element requires an additional hAPI adapter\n * that will handle authentication and session management.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * Payments API elements with hAPI, wrap them into this node._\n *\n * @element foxy-payments-api\n * @since 1.21.0\n */\nexport class PaymentsApi extends LitElement {\n static get properties(): PropertyDeclarations {\n return {\n paymentMethodSetHostedPaymentGatewayBaseUrl: {\n attribute: 'payment-method-set-hosted-payment-gateway-base-url',\n },\n\n paymentMethodSetHostedPaymentGatewaysUrl: {\n attribute: 'payment-method-set-hosted-payment-gateways-url',\n },\n\n hostedPaymentGatewaysHelperUrl: { attribute: 'hosted-payment-gateways-helper-url' },\n hostedPaymentGatewayBaseUrl: { attribute: 'hosted-payment-gateway-base-url' },\n hostedPaymentGatewaysUrl: { attribute: 'hosted-payment-gateways-url' },\n paymentGatewaysHelperUrl: { attribute: 'payment-gateways-helper-url' },\n paymentMethodSetBaseUrl: { attribute: 'payment-method-set-base-url' },\n paymentMethodSetsUrl: { attribute: 'payment-method-sets-url' },\n fraudProtectionBaseUrl: { attribute: 'fraud-protection-base-url' },\n fraudProtectionsUrl: { attribute: 'fraud-protections-url' },\n paymentGatewayBaseUrl: { attribute: 'payment-gateway-base-url' },\n paymentGatewaysUrl: { attribute: 'payment-gateways-url' },\n };\n }\n\n /**\n * Base URL of the `fx:payment_method_set_hosted_payment_gateway` resource (without ID).\n * @example https://api.foxy.io/payment_method_set_hosted_payment_gateways/\n */\n paymentMethodSetHostedPaymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_method_set_hosted_payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/payment_method_set_hosted_payment_gateways\n */\n paymentMethodSetHostedPaymentGatewaysUrl: string | null = null;\n\n /**\n * URL of the `fx:hosted_payment_gateways` property helper.\n * @example https://api.foxy.io/property_helpers/hosted_payment_gateways\n */\n hostedPaymentGatewaysHelperUrl: string | null = null;\n\n /**\n * Base URL of the `fx:hosted_payment_gateway` resource (without ID).\n * @example https://api.foxy.io/hosted_payment_gateways/\n */\n hostedPaymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:hosted_payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/hosted_payment_gateways\n */\n hostedPaymentGatewaysUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_gateways` property helper.\n * @example https://api.foxy.io/property_helpers/payment_gateways\n */\n paymentGatewaysHelperUrl: string | null = null;\n\n /**\n * Base URL of the `fx:payment_method_set` resource (without ID).\n * @example https://api.foxy.io/payment_method_sets/\n */\n paymentMethodSetBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_method_sets` collection.\n * @example https://api.foxy.io/stores/0/payment_method_sets\n */\n paymentMethodSetsUrl: string | null = null;\n\n /**\n * Base URL of the `fx:fraud_protection` resource (without ID).\n * @example https://api.foxy.io/fraud_protections/\n */\n fraudProtectionBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:fraud_protections` collection.\n * @example https://api.foxy.io/stores/0/fraud_protections\n */\n fraudProtectionsUrl: string | null = null;\n\n /**\n * Base URL of the `fx:payment_gateway` resource (without ID).\n * @example https://api.foxy.io/payment_gateways/\n */\n paymentGatewayBaseUrl: string | null = null;\n\n /**\n * URL of the `fx:payment_gateways` collection.\n * @example https://api.foxy.io/stores/0/payment_gateways\n */\n paymentGatewaysUrl: string | null = null;\n\n private readonly __api = new API(this);\n\n private readonly __fetch = this.__api.fetch.bind(this.__api);\n\n private readonly __handleFetch = (evt: Event) => {\n if (!(evt instanceof FetchEvent)) return;\n if (!evt.request.url.startsWith('https://foxy-payments-api.element/')) return;\n if (evt.defaultPrevented) return;\n\n const {\n paymentMethodSetHostedPaymentGatewaysUrl,\n hostedPaymentGatewaysHelperUrl,\n paymentGatewaysHelperUrl,\n hostedPaymentGatewaysUrl,\n paymentMethodSetsUrl,\n fraudProtectionsUrl,\n paymentGatewaysUrl,\n } = this;\n\n const paymentMethodSetHostedPaymentGatewayBaseUrl =\n this.paymentMethodSetHostedPaymentGatewayBaseUrl ??\n this.paymentMethodSetHostedPaymentGatewaysUrl;\n\n const hostedPaymentGatewayBaseUrl =\n this.hostedPaymentGatewayBaseUrl ?? this.hostedPaymentGatewaysUrl;\n\n const paymentMethodSetBaseUrl = this.paymentMethodSetBaseUrl ?? this.paymentMethodSetsUrl;\n const fraudProtectionBaseUrl = this.fraudProtectionBaseUrl ?? this.fraudProtectionsUrl;\n const paymentGatewayBaseUrl = this.paymentGatewayBaseUrl ?? this.paymentGatewaysUrl;\n\n if (paymentMethodSetHostedPaymentGatewaysUrl === null) return;\n if (paymentMethodSetHostedPaymentGatewayBaseUrl === null) return;\n if (hostedPaymentGatewaysHelperUrl === null) return;\n if (paymentGatewaysHelperUrl === null) return;\n if (hostedPaymentGatewaysUrl === null) return;\n if (hostedPaymentGatewayBaseUrl === null) return;\n if (paymentMethodSetsUrl === null) return;\n if (paymentMethodSetBaseUrl === null) return;\n if (fraudProtectionsUrl === null) return;\n if (fraudProtectionBaseUrl === null) return;\n if (paymentGatewaysUrl === null) return;\n if (paymentGatewayBaseUrl === null) return;\n\n const createGetter = (link: string) => (id: string) => {\n const url = new URL(link);\n if (!url.pathname.endsWith('/')) url.pathname += '/';\n url.pathname += id;\n return url.toString();\n };\n\n const handler = getHandler({\n hostedPaymentGatewaysHelperUrl,\n paymentGatewaysHelperUrl,\n hostedPaymentGatewaysUrl,\n paymentMethodSetsUrl,\n fraudProtectionsUrl,\n paymentGatewaysUrl,\n\n getPaymentMethodSetHostedPaymentGatewayUrl: createGetter(\n paymentMethodSetHostedPaymentGatewayBaseUrl\n ),\n\n getHostedPaymentGatewayUrl: createGetter(hostedPaymentGatewayBaseUrl),\n getPaymentMethodSetUrl: createGetter(paymentMethodSetBaseUrl),\n getFraudProtectionUrl: createGetter(fraudProtectionBaseUrl),\n getPaymentGatewayUrl: createGetter(paymentGatewayBaseUrl),\n\n request: evt.request,\n fetch: this.__fetch,\n });\n\n if (handler) {\n evt.preventDefault();\n evt.respondWith(handler);\n }\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__handleFetch);\n }\n\n createRenderRoot(): Element | ShadowRoot {\n return this;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__handleFetch);\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { ifDefined } from 'lit-html/directives/if-defined';
|
|
|
3
3
|
import { InternalControl } from "../../../../internal/InternalControl/InternalControl.js";
|
|
4
4
|
export class InternalTransactionActionsControl extends InternalControl {
|
|
5
5
|
renderControl() {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
7
7
|
return html `
|
|
8
8
|
<div class="flex flex-wrap gap-x-m gap-y-xs">
|
|
9
9
|
${((_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:capture']) ? this.__renderCaptureAction() : ''}
|
|
@@ -11,6 +11,7 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
11
11
|
${((_f = (_e = this.nucleon) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f._links['fx:refund']) ? this.__renderRefundAction() : ''}
|
|
12
12
|
${((_h = (_g = this.nucleon) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h._links['fx:send_emails']) ? this.__renderSendEmailsAction() : ''}
|
|
13
13
|
${((_k = (_j = this.nucleon) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k._links['fx:subscription']) ? this.__renderSubscriptionAction() : ''}
|
|
14
|
+
${((_m = (_l = this.nucleon) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m._links['fx:receipt']) ? this.__renderReceiptAction() : ''}
|
|
14
15
|
</div>
|
|
15
16
|
`;
|
|
16
17
|
}
|
|
@@ -74,5 +75,18 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
74
75
|
</a>
|
|
75
76
|
`;
|
|
76
77
|
}
|
|
78
|
+
__renderReceiptAction() {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const host = this.nucleon;
|
|
81
|
+
return html `
|
|
82
|
+
<a
|
|
83
|
+
target="_blank"
|
|
84
|
+
class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50"
|
|
85
|
+
href=${ifDefined((_b = (_a = host === null || host === void 0 ? void 0 : host.data) === null || _a === void 0 ? void 0 : _a._links['fx:receipt']) === null || _b === void 0 ? void 0 : _b.href)}
|
|
86
|
+
>
|
|
87
|
+
<foxy-i18n infer="receipt" key="caption"></foxy-i18n>
|
|
88
|
+
</a>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
77
91
|
}
|
|
78
92
|
//# sourceMappingURL=InternalTransactionActionsControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gEAA6D;AAGvF,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IACpE,aAAa;;QACX,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,GAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC1E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,gBAAgB,GAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE;UACnF,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,iBAAiB,GAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC,EAAE;;
|
|
1
|
+
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gEAA6D;AAGvF,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IACpE,aAAa;;QACX,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,C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,CAAC;IACJ,CAAC;IAEO,oBAAoB;;QAC1B,OAAO,IAAI,CAAA;;;eAGA,SAAS,mBAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,2CAAG,IAAI,CAAC;gBACvD,GAAG,EAAE,wBAAC,IAAI,CAAC,OAAO,0CAAE,OAAO,KAAE;;;KAGxC,CAAC;IACJ,CAAC;IAEO,0BAA0B;;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,OAA6B,CAAC;QAChD,MAAM,OAAO,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,0CAAE,MAAM,CAAC,iBAAiB,2CAAG,IAAI,CAAC;QAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,OAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,uBAAuB,+CAA7B,IAAI,EAA4B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAEhF,OAAO,IAAI,CAAA;;;eAGA,SAAS,CAAC,WAAW,CAAC;;;;KAIhC,CAAC;IACJ,CAAC;IAEO,qBAAqB;;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,OAA6B,CAAC;QAEhD,OAAO,IAAI,CAAA;;;;eAIA,SAAS,aAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,2CAAG,IAAI,CAAC;;;;KAI3D,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { html, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { Transaction } from '../../Transaction';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n renderControl(): TemplateResult {\n return html`\n <div class=\"flex flex-wrap gap-x-m gap-y-xs\">\n ${this.nucleon?.data?._links['fx:capture'] ? this.__renderCaptureAction() : ''}\n ${this.nucleon?.data?._links['fx:void'] ? this.__renderVoidAction() : ''}\n ${this.nucleon?.data?._links['fx:refund'] ? this.__renderRefundAction() : ''}\n ${this.nucleon?.data?._links['fx:send_emails'] ? this.__renderSendEmailsAction() : ''}\n ${this.nucleon?.data?._links['fx:subscription'] ? this.__renderSubscriptionAction() : ''}\n ${this.nucleon?.data?._links['fx:receipt'] ? this.__renderReceiptAction() : ''}\n </div>\n `;\n }\n\n private __renderSendEmailsAction() {\n return html`\n <foxy-internal-transaction-post-action-control\n infer=\"send-emails\"\n href=${ifDefined(this.nucleon?.data?._links['fx:send_emails'].href)}\n @done=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-transaction-post-action-control>\n `;\n }\n\n private __renderCaptureAction() {\n return html`\n <foxy-internal-transaction-post-action-control\n theme=\"success\"\n infer=\"capture\"\n href=${ifDefined(this.nucleon?.data?._links['fx:capture'].href)}\n @done=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-transaction-post-action-control>\n `;\n }\n\n private __renderVoidAction() {\n return html`\n <foxy-internal-transaction-post-action-control\n theme=\"error\"\n infer=\"void\"\n href=${ifDefined(this.nucleon?.data?._links['fx:void']?.href)}\n @done=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-transaction-post-action-control>\n `;\n }\n\n private __renderRefundAction() {\n return html`\n <foxy-internal-transaction-post-action-control\n infer=\"refund\"\n href=${ifDefined(this.nucleon?.data?._links['fx:refund']?.href)}\n @done=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-transaction-post-action-control>\n `;\n }\n\n private __renderSubscriptionAction() {\n const host = this.nucleon as Transaction | null;\n const subHref = host?.data?._links['fx:subscription']?.href;\n const subPageHref = subHref ? host?.getSubscriptionPageHref?.(subHref) : void 0;\n\n return html`\n <a\n class=\"rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${ifDefined(subPageHref)}\n >\n <foxy-i18n infer=\"subscription\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderReceiptAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <a\n target=\"_blank\"\n class=\"rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${ifDefined(host?.data?._links['fx:receipt']?.href)}\n >\n <foxy-i18n infer=\"receipt\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n}\n"]}
|