@foxy.io/elements 1.32.0 → 1.33.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.
Files changed (100) hide show
  1. package/dist/cdn/foxy-address-form.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-api-browser.js +1 -1
  4. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  5. package/dist/cdn/foxy-attribute-form.js +1 -1
  6. package/dist/cdn/foxy-cart-form.js +2 -2
  7. package/dist/cdn/foxy-client-form.js +1 -1
  8. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  10. package/dist/cdn/foxy-coupon-form.js +1 -1
  11. package/dist/cdn/foxy-custom-field-form.js +1 -1
  12. package/dist/cdn/foxy-customer-form.js +1 -1
  13. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  14. package/dist/cdn/foxy-customer-portal.js +1 -1
  15. package/dist/cdn/foxy-customer.js +1 -1
  16. package/dist/cdn/foxy-downloadable-form.js +1 -1
  17. package/dist/cdn/foxy-email-template-form.js +1 -1
  18. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  19. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  20. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  21. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  22. package/dist/cdn/foxy-gift-card-form.js +1 -1
  23. package/dist/cdn/foxy-integration-form.js +1 -1
  24. package/dist/cdn/foxy-item-category-form.js +1 -1
  25. package/dist/cdn/foxy-item-form.js +1 -1
  26. package/dist/cdn/foxy-item-option-form.js +1 -1
  27. package/dist/cdn/foxy-native-integration-form.js +1 -1
  28. package/dist/cdn/foxy-passkey-form.js +1 -1
  29. package/dist/cdn/foxy-payment-method-card.js +1 -1
  30. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  31. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  32. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  33. package/dist/cdn/foxy-store-form.js +1 -1
  34. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  35. package/dist/cdn/foxy-subscription-form.js +1 -1
  36. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  37. package/dist/cdn/foxy-template-config-form.js +1 -1
  38. package/dist/cdn/foxy-template-form.js +1 -1
  39. package/dist/cdn/foxy-template-set-form.js +1 -1
  40. package/dist/cdn/foxy-transaction.js +1 -1
  41. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  42. package/dist/cdn/foxy-user-form.js +1 -1
  43. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  44. package/dist/cdn/foxy-users-table.js +1 -1
  45. package/dist/cdn/foxy-webhook-form.js +1 -1
  46. package/dist/cdn/shared-0203d3da.js +1 -0
  47. package/dist/cdn/shared-14179b23.js +1 -0
  48. package/dist/cdn/shared-529f2b48.js +2 -0
  49. package/dist/cdn/shared-d367ea04.js +1 -0
  50. package/dist/cdn/translations/email-template-form/en.json +99 -27
  51. package/dist/cdn/translations/item-category-form/en.json +1 -1
  52. package/dist/cdn/translations/store-form/en.json +1 -1
  53. package/dist/cdn/translations/subscription-settings-form/en.json +6 -6
  54. package/dist/cdn/translations/template-form/en.json +67 -19
  55. package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.d.ts +1 -2
  56. package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.js +0 -3
  57. package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControlForm.js.map +1 -1
  58. package/dist/elements/internal/InternalSourceControl/InternalSourceControl.js +6 -26
  59. package/dist/elements/internal/InternalSourceControl/InternalSourceControl.js.map +1 -1
  60. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +1 -1
  61. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
  62. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js +1 -1
  63. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +1 -1
  64. package/dist/elements/public/CartForm/internal/InternalCartFormCreateSessionAction/InternalCartFormCreateSessionAction.js +0 -1
  65. package/dist/elements/public/CartForm/internal/InternalCartFormCreateSessionAction/InternalCartFormCreateSessionAction.js.map +1 -1
  66. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +12 -20
  67. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +100 -333
  68. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
  69. package/dist/elements/public/EmailTemplateForm/index.d.ts +5 -7
  70. package/dist/elements/public/EmailTemplateForm/index.js +5 -7
  71. package/dist/elements/public/EmailTemplateForm/index.js.map +1 -1
  72. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/InternalEmailTemplateFormAsyncAction.d.ts +10 -0
  73. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/InternalEmailTemplateFormAsyncAction.js +49 -0
  74. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/InternalEmailTemplateFormAsyncAction.js.map +1 -0
  75. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/index.d.ts +5 -0
  76. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/index.js +7 -0
  77. package/dist/elements/public/EmailTemplateForm/internal/InternalEmailTemplateFormAsyncAction/index.js.map +1 -0
  78. package/dist/elements/public/EmailTemplateForm/types.d.ts +3 -1
  79. package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
  80. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +3 -3
  81. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  82. package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js +6 -6
  83. package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js.map +1 -1
  84. package/dist/elements/public/TemplateForm/TemplateForm.d.ts +10 -18
  85. package/dist/elements/public/TemplateForm/TemplateForm.js +54 -305
  86. package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
  87. package/dist/elements/public/TemplateForm/index.d.ts +4 -6
  88. package/dist/elements/public/TemplateForm/index.js +4 -6
  89. package/dist/elements/public/TemplateForm/index.js.map +1 -1
  90. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/InternalTemplateFormAsyncAction.d.ts +10 -0
  91. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/InternalTemplateFormAsyncAction.js +49 -0
  92. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/InternalTemplateFormAsyncAction.js.map +1 -0
  93. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/index.d.ts +5 -0
  94. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/index.js +7 -0
  95. package/dist/elements/public/TemplateForm/internal/InternalTemplateFormAsyncAction/index.js.map +1 -0
  96. package/package.json +1 -1
  97. package/dist/cdn/shared-015da8ca.js +0 -1
  98. package/dist/cdn/shared-a84befbf.js +0 -1
  99. package/dist/cdn/shared-d0e0f8a1.js +0 -2
  100. package/dist/cdn/shared-fb18400f.js +0 -1
@@ -1 +1 @@
1
- import"./shared-fb18400f.js";import"./shared-b3d36746.js";import"./shared-a84befbf.js";import"./shared-91500a0f.js";import"./shared-91321de3.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-015da8ca.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-6d7c1a2f.js";import{T as a}from"./shared-8874ec69.js";import{i}from"./shared-9803aa7c.js";import{h as d}from"./shared-dc73b9a5.js";import"./shared-935adc3b.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-nucleon-element.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-4e709717.js";import"./shared-99940888.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3a7db771.js";import"./shared-4b52b410.js";import"./shared-4b4c8ccf.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-22ba9566.js";import"./shared-0e83a899.js";import"./shared-fd1adc35.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:a.String,path:"id",label:"filters.id"},{type:a.String,path:"tax_id",label:"filters.tax_id"},{type:a.String,path:"email",label:"filters.email"},{type:a.String,path:"first_name",label:"filters.first_name"},{type:a.String,path:"last_name",label:"filters.last_name"},{type:a.Boolean,path:"is_anonymous",label:"filters.is_anonymous",list:[{label:"filters.is_anonymous_true",value:"true"},{label:"filters.is_anonymous_false",value:"false"}]},{type:a.Date,path:"last_login_date",label:"filters.last_login_date"},{type:a.Date,path:"date_created",label:"filters.date_created"},{type:a.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,a,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" 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(),i(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),i(null===(m=null===(a=this.data)||void 0===a?void 0:a._links)||void 0===m?void 0:m["fx:gift_card_code_logs"].href),super.renderBody(),i(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
+ import"./shared-14179b23.js";import"./shared-b3d36746.js";import"./shared-d367ea04.js";import"./shared-91500a0f.js";import"./shared-91321de3.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.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-6d7c1a2f.js";import{T as i}from"./shared-8874ec69.js";import{i as a}from"./shared-9803aa7c.js";import{h as d}from"./shared-dc73b9a5.js";import"./shared-935adc3b.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-nucleon-element.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-4e709717.js";import"./shared-99940888.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3a7db771.js";import"./shared-4b52b410.js";import"./shared-4b4c8ccf.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-22ba9566.js";import"./shared-0e83a899.js";import"./shared-fd1adc35.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" 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-4beb6fef.js";import"./shared-91500a0f.js";import{I as r}from"./shared-015da8ca.js";import{a as e}from"./shared-6d7c1a2f.js";import{B as s}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let d,a=r=>r;const o=e(r,"gift-card-codes-form");class i extends o{constructor(){super(...arguments),this.__giftCardCodesGetValue=()=>{var r,e;return null!==(e=null===(r=this.form.gift_card_codes)||void 0===r?void 0:r.map((r=>({value:r}))))&&void 0!==e?e:[]},this.__giftCardCodesSetValue=r=>{this.edit({gift_card_codes:r.map((({value:r})=>r.split(" ").map((r=>r.trim())))).flat().filter(((r,e,s)=>s.indexOf(r)===e))})}}static get v8n(){return[({gift_card_codes:r})=>r&&r.length>0||"gift-card-codes:v8n_required"]}get readonlySelector(){const r=[super.readonlySelector.toString()];return this.href&&r.push("gift-card-codes"),new s(r.join(" ").trim())}get hiddenSelector(){const r=["delete timestamps",super.hiddenSelector.toString()];return new s(r.join(" ").trim())}renderBody(){return t(d||(d=a` <foxy-internal-editable-list-control infer="gift-card-codes" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-number-control infer="current-balance" min="0"></foxy-internal-number-control> ${0} `),this.__giftCardCodesGetValue,this.__giftCardCodesSetValue,super.renderBody())}async _sendPost(r){const e=JSON.stringify(r),s=await this._fetch(this.parent,{body:e,method:"POST"});return this.status={key:"success"},s}}customElements.define("foxy-gift-card-codes-form",i);export{i as GiftCardCodesForm};
1
+ import"./shared-4beb6fef.js";import"./shared-91500a0f.js";import{I as r}from"./shared-0203d3da.js";import{a as e}from"./shared-6d7c1a2f.js";import{B as s}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-dbe8536b.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-08be5c32.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let d,a=r=>r;const o=e(r,"gift-card-codes-form");class i extends o{constructor(){super(...arguments),this.__giftCardCodesGetValue=()=>{var r,e;return null!==(e=null===(r=this.form.gift_card_codes)||void 0===r?void 0:r.map((r=>({value:r}))))&&void 0!==e?e:[]},this.__giftCardCodesSetValue=r=>{this.edit({gift_card_codes:r.map((({value:r})=>r.split(" ").map((r=>r.trim())))).flat().filter(((r,e,s)=>s.indexOf(r)===e))})}}static get v8n(){return[({gift_card_codes:r})=>r&&r.length>0||"gift-card-codes:v8n_required"]}get readonlySelector(){const r=[super.readonlySelector.toString()];return this.href&&r.push("gift-card-codes"),new s(r.join(" ").trim())}get hiddenSelector(){const r=["delete timestamps",super.hiddenSelector.toString()];return new s(r.join(" ").trim())}renderBody(){return t(d||(d=a` <foxy-internal-editable-list-control infer="gift-card-codes" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-number-control infer="current-balance" min="0"></foxy-internal-number-control> ${0} `),this.__giftCardCodesGetValue,this.__giftCardCodesSetValue,super.renderBody())}async _sendPost(r){const e=JSON.stringify(r),s=await this._fetch(this.parent,{body:e,method:"POST"});return this.status={key:"success"},s}}customElements.define("foxy-gift-card-codes-form",i);export{i as GiftCardCodesForm};
@@ -1 +1 @@
1
- import"./shared-81bf4ca2.js";import"./shared-14bf37ae.js";import"./shared-4beb6fef.js";import"./shared-b3d36746.js";import"./shared-3ca58fb9.js";import"./shared-a84befbf.js";import"./shared-53443b27.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-015da8ca.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-dc73b9a5.js";import{R as a,a as s}from"./shared-6d7c1a2f.js";import{i as n}from"./shared-9803aa7c.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-22ba9566.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-d0e0f8a1.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-0e83a899.js";import"./shared-fb18400f.js";import"./shared-91321de3.js";import"./shared-3a7db771.js";import"./shared-4b4c8ccf.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./shared-4f852fd5.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 c,l,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(c||(c=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,c,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(l||(l=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===(c=this.data)||void 0===c?void 0:c._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-81bf4ca2.js";import"./shared-14bf37ae.js";import"./shared-4beb6fef.js";import"./shared-b3d36746.js";import"./shared-3ca58fb9.js";import"./shared-d367ea04.js";import"./shared-53443b27.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.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-dc73b9a5.js";import{R as a,a as s}from"./shared-6d7c1a2f.js";import{i as n}from"./shared-9803aa7c.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-22ba9566.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-529f2b48.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-0e83a899.js";import"./shared-14179b23.js";import"./shared-91321de3.js";import"./shared-3a7db771.js";import"./shared-4b4c8ccf.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-customer-card.js";import"./shared-4f852fd5.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 c,l,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(c||(c=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,c,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(l||(l=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===(c=this.data)||void 0===c?void 0:c._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"./shared-935adc3b.js";import"./shared-51efaf53.js";import{I as e}from"./shared-015da8ca.js";import"./shared-bbc53ef2.js";import"./shared-51c4a6dd.js";import"./foxy-copy-to-clipboard.js";import"./shared-3bfbd5af.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{a as s}from"./shared-6d7c1a2f.js";import{c as a}from"./shared-4e709717.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-97627d50.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-2dd497e5.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-bab2ea2c.js";import"./shared-22ba9566.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";let i,n,d,l,c,h,p,_,m,b,f,u,y=e=>e;const j=s(e,"integration-form");class x extends j{constructor(){super(...arguments),this.__postResponse=null}static get properties(){return r(r({},super.properties),{},{__postResponse:{attribute:!1}})}static get v8n(){return[({project_name:e})=>!!e||"project-name:v8n_required"]}get hiddenSelector(){return new t(`header:copy-id ${super.hiddenSelector}`.trimEnd())}renderBody(){return this.data?this.__renderSnapshotBody():this.__renderTemplateBody()}async _fetch(...e){var r;const t=this.constructor,s=await new t.API(this).fetch(...e),a="string"==typeof e[0]?null===(r=e[1])||void 0===r?void 0:r.method:e[0].method,o="string"==typeof e[0]?e[0]:e[0].url;if(!s.ok)throw s;const i=await s.json();return"POST"===(null==a?void 0:a.toUpperCase())&&o===this.parent&&(this.__postResponse=i),i}__renderSnapshotBody(){const e=this.hiddenSelector,r=this.__postResponse;return o(i||(i=y` ${0} ${0} ${0} <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `),this.renderHeader(),e.matches("message",!0)||!r?"":this.__renderMessage(),e.matches("table")?"":this.__renderTable())}__renderTemplateBody(){return o(n||(n=y` ${0} <foxy-internal-text-control infer="project-name"></foxy-internal-text-control> <foxy-internal-text-area-control infer="project-description"> </foxy-internal-text-area-control> <foxy-internal-submit-control infer="create"></foxy-internal-submit-control> `),this.renderHeader())}__renderMessage(){return o(d||(d=y` ${0} <div class="bg-success-10 text-success p-m pb-s space-y-xs leading-s rounded-t-l rounded-b-l"> <foxy-i18n infer="message" class="block" key="text"></foxy-i18n> <vaadin-button data-testid="message-action" theme="tertiary contrast" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="message" key="action"></foxy-i18n> </vaadin-button> </div> ${0} `),this.renderTemplateOrSlot("message:before"),this.disabledSelector.matches("message",!0),(()=>this.__postResponse=null),this.renderTemplateOrSlot("message:after"))}__renderTable(){var e;const r=this.data,t=new Date(1e3*(null!==(e=r.expires)&&void 0!==e?e:0)),s=this.__postResponse;return o(l||(l=y` ${0} <table class="font-lumo text-m leading-m w-full"> <tbody class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} </tbody> </table> ${0} `),this.renderTemplateOrSlot("table:before"),this.__renderTableRow({label:this.__renderTableI18n("added_by"),value:this.__renderMailToLink(r.added_by_email,r.added_by_name)}),this.__renderTableRow({label:this.__renderTableI18n("contact"),value:this.__renderMailToLink(r.contact_email,r.contact_name)}),this.__renderTableRow({label:this.__renderTableI18n("company"),value:this.__renderLink(r.company_url,r.company_name)}),this.__renderTableRow({label:this.__renderTableI18n("expires"),value:this.__renderTableI18n("expires_date",{date:t})}),this.__renderTableRow({label:"Client ID",value:this.__renderCopiableText(r.client_id)}),s?o(c||(c=y` ${0} ${0} ${0} `),this.__renderTableRow({highlight:!0,label:"Client secret",value:this.__renderCopiableText(s.client_secret)}),this.__renderTableRow({highlight:!0,label:"Refresh token",value:this.__renderCopiableText(s.refresh_token)}),this.__renderTableRow({highlight:!0,label:"Access token",value:this.__renderCopiableText(s.access_token)})):"",this.__renderTableRow({label:"Scope",value:o(h||(h=y`<code>${0}</code>`),r.scope)}),this.renderTemplateOrSlot("table:after"))}__renderCopiableText(e){return o(p||(p=y` <div class="flex items-center gap-s"> <code class="truncate flex-1">${0}</code> <foxy-copy-to-clipboard infer="copy-to-clipboard" class="inline-block" text="${0}"> </foxy-copy-to-clipboard> </div> `),e,e)}__renderMailToLink(e,r){return e?this.__renderLink(`mailto:${e}`,r):o(_||(_=y`${0}`),r)}__renderLink(e,r){return e?o(b||(b=y` <a target="_blank" class="font-medium text-primary rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> ${0} </a> `),e,r):o(m||(m=y`${0}`),r)}__renderTableRow(e){const{label:r,value:t,highlight:s=!1}=e;return o(f||(f=y` <tr class="${0}"> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m">${0}</td> <td class="max-w-0 truncate py-s text-body w-2-3">${0}</td> </tr> `),a({"font-medium text-success":s}),r,t)}__renderTableI18n(e,r){return o(u||(u=y`<foxy-i18n infer="table" key="${0}" .options="${0}"></foxy-i18n>`),e,r)}}customElements.define("foxy-integration-form",x);export{x as IntegrationForm};
1
+ import"./shared-935adc3b.js";import"./shared-51efaf53.js";import{I as e}from"./shared-0203d3da.js";import"./shared-bbc53ef2.js";import"./shared-51c4a6dd.js";import"./foxy-copy-to-clipboard.js";import"./shared-3bfbd5af.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{a as s}from"./shared-6d7c1a2f.js";import{c as a}from"./shared-4e709717.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-97627d50.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-2dd497e5.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-bab2ea2c.js";import"./shared-22ba9566.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";let i,n,d,l,c,h,p,_,m,b,f,u,y=e=>e;const j=s(e,"integration-form");class x extends j{constructor(){super(...arguments),this.__postResponse=null}static get properties(){return r(r({},super.properties),{},{__postResponse:{attribute:!1}})}static get v8n(){return[({project_name:e})=>!!e||"project-name:v8n_required"]}get hiddenSelector(){return new t(`header:copy-id ${super.hiddenSelector}`.trimEnd())}renderBody(){return this.data?this.__renderSnapshotBody():this.__renderTemplateBody()}async _fetch(...e){var r;const t=this.constructor,s=await new t.API(this).fetch(...e),a="string"==typeof e[0]?null===(r=e[1])||void 0===r?void 0:r.method:e[0].method,o="string"==typeof e[0]?e[0]:e[0].url;if(!s.ok)throw s;const i=await s.json();return"POST"===(null==a?void 0:a.toUpperCase())&&o===this.parent&&(this.__postResponse=i),i}__renderSnapshotBody(){const e=this.hiddenSelector,r=this.__postResponse;return o(i||(i=y` ${0} ${0} ${0} <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `),this.renderHeader(),e.matches("message",!0)||!r?"":this.__renderMessage(),e.matches("table")?"":this.__renderTable())}__renderTemplateBody(){return o(n||(n=y` ${0} <foxy-internal-text-control infer="project-name"></foxy-internal-text-control> <foxy-internal-text-area-control infer="project-description"> </foxy-internal-text-area-control> <foxy-internal-submit-control infer="create"></foxy-internal-submit-control> `),this.renderHeader())}__renderMessage(){return o(d||(d=y` ${0} <div class="bg-success-10 text-success p-m pb-s space-y-xs leading-s rounded-t-l rounded-b-l"> <foxy-i18n infer="message" class="block" key="text"></foxy-i18n> <vaadin-button data-testid="message-action" theme="tertiary contrast" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="message" key="action"></foxy-i18n> </vaadin-button> </div> ${0} `),this.renderTemplateOrSlot("message:before"),this.disabledSelector.matches("message",!0),(()=>this.__postResponse=null),this.renderTemplateOrSlot("message:after"))}__renderTable(){var e;const r=this.data,t=new Date(1e3*(null!==(e=r.expires)&&void 0!==e?e:0)),s=this.__postResponse;return o(l||(l=y` ${0} <table class="font-lumo text-m leading-m w-full"> <tbody class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} </tbody> </table> ${0} `),this.renderTemplateOrSlot("table:before"),this.__renderTableRow({label:this.__renderTableI18n("added_by"),value:this.__renderMailToLink(r.added_by_email,r.added_by_name)}),this.__renderTableRow({label:this.__renderTableI18n("contact"),value:this.__renderMailToLink(r.contact_email,r.contact_name)}),this.__renderTableRow({label:this.__renderTableI18n("company"),value:this.__renderLink(r.company_url,r.company_name)}),this.__renderTableRow({label:this.__renderTableI18n("expires"),value:this.__renderTableI18n("expires_date",{date:t})}),this.__renderTableRow({label:"Client ID",value:this.__renderCopiableText(r.client_id)}),s?o(c||(c=y` ${0} ${0} ${0} `),this.__renderTableRow({highlight:!0,label:"Client secret",value:this.__renderCopiableText(s.client_secret)}),this.__renderTableRow({highlight:!0,label:"Refresh token",value:this.__renderCopiableText(s.refresh_token)}),this.__renderTableRow({highlight:!0,label:"Access token",value:this.__renderCopiableText(s.access_token)})):"",this.__renderTableRow({label:"Scope",value:o(h||(h=y`<code>${0}</code>`),r.scope)}),this.renderTemplateOrSlot("table:after"))}__renderCopiableText(e){return o(p||(p=y` <div class="flex items-center gap-s"> <code class="truncate flex-1">${0}</code> <foxy-copy-to-clipboard infer="copy-to-clipboard" class="inline-block" text="${0}"> </foxy-copy-to-clipboard> </div> `),e,e)}__renderMailToLink(e,r){return e?this.__renderLink(`mailto:${e}`,r):o(_||(_=y`${0}`),r)}__renderLink(e,r){return e?o(b||(b=y` <a target="_blank" class="font-medium text-primary rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> ${0} </a> `),e,r):o(m||(m=y`${0}`),r)}__renderTableRow(e){const{label:r,value:t,highlight:s=!1}=e;return o(f||(f=y` <tr class="${0}"> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m">${0}</td> <td class="max-w-0 truncate py-s text-body w-2-3">${0}</td> </tr> `),a({"font-medium text-success":s}),r,t)}__renderTableI18n(e,r){return o(u||(u=y`<foxy-i18n infer="table" key="${0}" .options="${0}"></foxy-i18n>`),e,r)}}customElements.define("foxy-integration-form",x);export{x as IntegrationForm};
@@ -1 +1 @@
1
- import"./shared-81bf4ca2.js";import"./shared-fb18400f.js";import"./shared-a84befbf.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-015da8ca.js";import"./foxy-email-template-card.js";import"./foxy-discount-builder.js";import"./foxy-tax-card.js";import"./shared-3bfbd5af.js";import{_ as t,B as r}from"./shared-d1195c27.js";import{a as n}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{h as o,s as a}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-nucleon-element.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-b3d36746.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-8438d4ca.js";let l,s,d,m,p,u,f,_,c,y,h,g=e=>e;class x extends(n(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.taxes=null}static get properties(){return t(t({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative"]}get readonlySelector(){var e;const t=[super.readonlySelector.toString()];return"DEFAULT"===(null===(e=this.data)||void 0===e?void 0:e.code)&&t.unshift("code","name"),new r(t.join(" ").trim())}get hiddenSelector(){var e;const t=[super.hiddenSelector.toString()];return this.data||t.unshift("taxes"),"DEFAULT"===(null===(e=this.data)||void 0===e?void 0:e.code)&&t.unshift("delete"),new r(t.join(" ").trim())}renderBody(){var e,t,r,n,m;const p=this.form.item_delivery_type,u=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(l||(l=g` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control infer="name" layout="summary-item"></foxy-internal-text-control> <foxy-internal-text-control infer="code" layout="summary-item"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="tax_uri" foreign-key-for-id="tax_id" own-key-for-uri="item_category_uri" options-href="${0}" links-href="${0}" embed-key="fx:tax_item_categories" own-uri="${0}" infer="taxes" limit="5" item="foxy-tax-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="delivery"> <foxy-internal-select-control layout="summary-item" infer="item-delivery-type" .options="${0}"> </foxy-internal-select-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="handling-and-discount"> <foxy-internal-select-control layout="summary-item" infer="handling-fee-type" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="gift-recipient-email-template-uri" item="foxy-email-template-card"> </foxy-internal-resource-picker-control> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="wip_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> </foxy-internal-summary-control> ${0} `),this.renderHeader(),i(null!==(t=this.taxes)&&void 0!==t?t:void 0),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:tax_item_categories"].href),i(null===(n=this.data)||void 0===n?void 0:n._links.self.href),x.__itemDeliveryTypeOptions,"downloaded"===p?this.__renderDownloadDeliveryControls():"flat_rate"===p?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===p?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",x.__handlingFeeTypeOptions,"none"===u?"":o(s||(s=g` ${0} ${0} ${0} `),this.__renderHandlingFee(),u.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===u?this.__renderHandlingFeeMinimum():""),this.form.discount_name?this.__renderDiscountBuilder():"",i(null!==(m=this.emailTemplates)&&void 0!==m?m:void 0),a(d||(d=g`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),super.renderBody())}__renderHandlingFee(){return o(m||(m=g` <foxy-internal-number-control layout="summary-item" infer="handling-fee" min="0"> </foxy-internal-number-control> `))}__renderHandlingFeePercentage(){return o(p||(p=g` <foxy-internal-number-control layout="summary-item" suffix="%" infer="handling-fee-percentage" min="0"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(u||(u=g` <foxy-internal-number-control layout="summary-item" infer="handling-fee-minimum" min="0"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(f||(f=g` <foxy-internal-number-control layout="summary-item" infer="max-downloads-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="max-downloads-time-period" step="1" min="0"> </foxy-internal-number-control> `))}__renderFlatRateControls(){return o(_||(_=g` <foxy-internal-number-control layout="summary-item" infer="shipping-flat-rate" min="0"> </foxy-internal-number-control> <foxy-internal-select-control layout="summary-item" infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),x.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(c||(c=g` <foxy-internal-number-control layout="summary-item" infer="default-weight" min="0"> </foxy-internal-number-control> <foxy-internal-select-control layout="summary-item" infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control layout="summary-item" infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),x.__defaultWeightUnitOptions,x.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(y||(y=g` <foxy-internal-number-control layout="summary-item" infer="customs-value" min="0"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const r={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(h||(h=g` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),r,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}}x.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],x.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],x.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],x.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],x.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",x);export{x as ItemCategoryForm};
1
+ import"./shared-81bf4ca2.js";import"./shared-14179b23.js";import"./shared-d367ea04.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-email-template-card.js";import"./foxy-discount-builder.js";import"./foxy-tax-card.js";import"./shared-3bfbd5af.js";import{_ as t,B as r}from"./shared-d1195c27.js";import{a as n}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{h as o,s as a}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-nucleon-element.js";import"./foxy-pagination.js";import"./shared-935adc3b.js";import"./shared-4e709717.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-b3d36746.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-8438d4ca.js";let l,s,d,m,p,u,f,_,c,y,h,g=e=>e;class x extends(n(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.taxes=null}static get properties(){return t(t({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative"]}get readonlySelector(){var e;const t=[super.readonlySelector.toString()];return"DEFAULT"===(null===(e=this.data)||void 0===e?void 0:e.code)&&t.unshift("code","name"),new r(t.join(" ").trim())}get hiddenSelector(){var e;const t=[super.hiddenSelector.toString()];return this.data||t.unshift("taxes"),"DEFAULT"===(null===(e=this.data)||void 0===e?void 0:e.code)&&t.unshift("delete"),new r(t.join(" ").trim())}renderBody(){var e,t,r,n,m;const p=this.form.item_delivery_type,u=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(l||(l=g` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control infer="name" layout="summary-item"></foxy-internal-text-control> <foxy-internal-text-control infer="code" layout="summary-item"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="tax_uri" foreign-key-for-id="tax_id" own-key-for-uri="item_category_uri" options-href="${0}" links-href="${0}" embed-key="fx:tax_item_categories" own-uri="${0}" infer="taxes" limit="5" item="foxy-tax-card"> </foxy-internal-async-resource-link-list-control> <foxy-internal-summary-control infer="delivery"> <foxy-internal-select-control layout="summary-item" infer="item-delivery-type" .options="${0}"> </foxy-internal-select-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="handling-and-discount"> <foxy-internal-select-control layout="summary-item" infer="handling-fee-type" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="emails"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="gift-recipient-email-template-uri" item="foxy-email-template-card"> </foxy-internal-resource-picker-control> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="wip_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> </foxy-internal-summary-control> ${0} `),this.renderHeader(),i(null!==(t=this.taxes)&&void 0!==t?t:void 0),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:tax_item_categories"].href),i(null===(n=this.data)||void 0===n?void 0:n._links.self.href),x.__itemDeliveryTypeOptions,"downloaded"===p?this.__renderDownloadDeliveryControls():"flat_rate"===p?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===p?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",x.__handlingFeeTypeOptions,"none"===u?"":o(s||(s=g` ${0} ${0} ${0} `),this.__renderHandlingFee(),u.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===u?this.__renderHandlingFeeMinimum():""),this.form.discount_name?this.__renderDiscountBuilder():"",i(null!==(m=this.emailTemplates)&&void 0!==m?m:void 0),a(d||(d=g`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),super.renderBody())}__renderHandlingFee(){return o(m||(m=g` <foxy-internal-number-control layout="summary-item" infer="handling-fee" min="0"> </foxy-internal-number-control> `))}__renderHandlingFeePercentage(){return o(p||(p=g` <foxy-internal-number-control layout="summary-item" suffix="%" infer="handling-fee-percentage" min="0"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(u||(u=g` <foxy-internal-number-control layout="summary-item" infer="handling-fee-minimum" min="0"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(f||(f=g` <foxy-internal-number-control layout="summary-item" infer="max-downloads-per-customer" step="1" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="max-downloads-time-period" step="1" min="0"> </foxy-internal-number-control> `))}__renderFlatRateControls(){return o(_||(_=g` <foxy-internal-number-control layout="summary-item" infer="shipping-flat-rate" min="0"> </foxy-internal-number-control> <foxy-internal-select-control layout="summary-item" infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),x.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(c||(c=g` <foxy-internal-number-control layout="summary-item" infer="default-weight" min="0"> </foxy-internal-number-control> <foxy-internal-select-control layout="summary-item" infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control layout="summary-item" infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),x.__defaultWeightUnitOptions,x.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(y||(y=g` <foxy-internal-number-control layout="summary-item" infer="customs-value" min="0"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const r={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(h||(h=g` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),r,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}}x.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],x.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],x.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],x.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],x.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",x);export{x as ItemCategoryForm};
@@ -1 +1 @@
1
- import"./shared-fb18400f.js";import"./shared-b3d36746.js";import"./shared-3ca58fb9.js";import"./shared-a84befbf.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import"./shared-91321de3.js";import{I as t}from"./shared-015da8ca.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"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as e}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-935adc3b.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-99940888.js";import"./shared-bab2ea2c.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-3a7db771.js";import"./shared-4b4c8ccf.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-8438d4ca.js";import"./shared-4f852fd5.js";import"./shared-d0e0f8a1.js";let a,l=t=>t;class m extends(o(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.store=null,this.__itemsLink=""}static get properties(){return r(r({},super.properties),{},{customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{},store:{}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}get headerSubtitleOptions(){var t;return{context:(null===(t=this.data)||void 0===t?void 0:t.is_future_line_item)?"future_line_item":"regular"}}get readonlySelector(){const t=[super.readonlySelector.toString()];return this.href&&t.unshift("subscriptions"),new e(t.join(" ").trim())}get hiddenSelector(){var t,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(t=this.__storeLoader)||void 0===t?void 0:t.data)||void 0===r?void 0:r.features_multiship)||o.unshift("general:shipto"),this.data&&!this.data.subscription_frequency&&o.unshift("subscriptions"),this.form.discount_name||o.unshift("discount:discount-builder"),this.href||o.unshift("discount-details","coupon-details","item-options","attributes"),new e(o.join(" ").trim())}renderBody(){var t,r,e,o,m,d,c;return s(a||(a=l` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="price" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="parent-code"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="shipto"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="subscriptions"> <foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="subscription-start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="subscription-end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="item-options" first="${0}" form="foxy-item-option-form" item="foxy-item-option-card" alert .related="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="dimensions"> <foxy-internal-number-control layout="summary-item" infer="weight" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="height" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="meta"> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="image"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" infer="expires" format="unix"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="discount"> <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" class="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="discount-details" first="${0}" item="foxy-discount-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="coupon-details" first="${0}" item="foxy-coupon-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null!==(t=null==this?void 0:this.itemCategories)&&void 0!==t?t:void 0),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:item_options"].href),this.__itemOptionRelatedUrls,{"locale-codes":null!==(e=this.localeCodes)&&void 0!==e?e:""},n({hidden:this.hiddenSelector.matches("discount-builder",!0)}),this.__discountBuilderParsedValue,this.__handleDiscountBuilderChange,i(null===(o=this.data)||void 0===o?void 0:o._links["fx:discount_details"].href),i(null===(m=this.data)||void 0===m?void 0:m._links["fx:coupon_details"].href),i(null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"].href),super.renderBody(),i(null!==(c=this.store)&&void 0!==c?c:void 0),(()=>this.requestUpdate()))}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const r=t._links["fx:subscription"].href,e=(await super._fetch(r))._links["fx:transaction_template"].href,o=await super._fetch(e);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const r=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=r._links["fx:items"].href,t}if(t._links["fx:cart"]){const r=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=r._links["fx:items"].href,t}return t}get __discountBuilderParsedValue(){return{details:this.form.discount_details,type:this.form.discount_type,name:this.form.discount_name}}get __itemOptionRelatedUrls(){var t,r;const e=null!==(r=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==r?r:{},o=[];return e["fx:subscription"]&&o.push(e["fx:subscription"].href),e["fx:transaction"]&&o.push(e["fx:transaction"].href),e["fx:shipment"]&&o.push(e["fx:shipment"].href),e["fx:cart"]&&o.push(e["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}__handleDiscountBuilderChange(t){const r=t.currentTarget.parsedValue;this.edit({discount_details:r.details,discount_type:r.type,discount_name:r.name})}}customElements.define("foxy-item-form",m);export{m as ItemForm};
1
+ import"./shared-14179b23.js";import"./shared-b3d36746.js";import"./shared-3ca58fb9.js";import"./shared-d367ea04.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import"./shared-91321de3.js";import{I as t}from"./shared-0203d3da.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"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as r,B as e}from"./shared-d1195c27.js";import{a as o}from"./shared-6d7c1a2f.js";import{i}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-935adc3b.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-form-dialog.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./shared-99940888.js";import"./shared-bab2ea2c.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-cacd4407.js";import"./shared-1024aa20.js";import"./shared-3493737e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-3a7db771.js";import"./shared-4b4c8ccf.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./shared-8438d4ca.js";import"./shared-4f852fd5.js";import"./shared-529f2b48.js";let a,l=t=>t;class m extends(o(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.store=null,this.__itemsLink=""}static get properties(){return r(r({},super.properties),{},{customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{},store:{}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}get headerSubtitleOptions(){var t;return{context:(null===(t=this.data)||void 0===t?void 0:t.is_future_line_item)?"future_line_item":"regular"}}get readonlySelector(){const t=[super.readonlySelector.toString()];return this.href&&t.unshift("subscriptions"),new e(t.join(" ").trim())}get hiddenSelector(){var t,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(t=this.__storeLoader)||void 0===t?void 0:t.data)||void 0===r?void 0:r.features_multiship)||o.unshift("general:shipto"),this.data&&!this.data.subscription_frequency&&o.unshift("subscriptions"),this.form.discount_name||o.unshift("discount:discount-builder"),this.href||o.unshift("discount-details","coupon-details","item-options","attributes"),new e(o.join(" ").trim())}renderBody(){var t,r,e,o,m,d,c;return s(a||(a=l` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="price" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="parent-code"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="shipto"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="subscriptions"> <foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="subscription-start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="subscription-end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="item-options" first="${0}" form="foxy-item-option-form" item="foxy-item-option-card" alert .related="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="dimensions"> <foxy-internal-number-control layout="summary-item" infer="weight" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="height" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="meta"> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="image"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" infer="expires" format="unix"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="discount"> <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" class="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="discount-details" first="${0}" item="foxy-discount-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="coupon-details" first="${0}" item="foxy-coupon-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null!==(t=null==this?void 0:this.itemCategories)&&void 0!==t?t:void 0),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:item_options"].href),this.__itemOptionRelatedUrls,{"locale-codes":null!==(e=this.localeCodes)&&void 0!==e?e:""},n({hidden:this.hiddenSelector.matches("discount-builder",!0)}),this.__discountBuilderParsedValue,this.__handleDiscountBuilderChange,i(null===(o=this.data)||void 0===o?void 0:o._links["fx:discount_details"].href),i(null===(m=this.data)||void 0===m?void 0:m._links["fx:coupon_details"].href),i(null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"].href),super.renderBody(),i(null!==(c=this.store)&&void 0!==c?c:void 0),(()=>this.requestUpdate()))}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const r=t._links["fx:subscription"].href,e=(await super._fetch(r))._links["fx:transaction_template"].href,o=await super._fetch(e);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const r=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=r._links["fx:items"].href,t}if(t._links["fx:cart"]){const r=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=r._links["fx:items"].href,t}return t}get __discountBuilderParsedValue(){return{details:this.form.discount_details,type:this.form.discount_type,name:this.form.discount_name}}get __itemOptionRelatedUrls(){var t,r;const e=null!==(r=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==r?r:{},o=[];return e["fx:subscription"]&&o.push(e["fx:subscription"].href),e["fx:transaction"]&&o.push(e["fx:transaction"].href),e["fx:shipment"]&&o.push(e["fx:shipment"].href),e["fx:cart"]&&o.push(e["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}__handleDiscountBuilderChange(t){const r=t.currentTarget.parsedValue;this.edit({discount_details:r.details,discount_type:r.type,discount_name:r.name})}}customElements.define("foxy-item-form",m);export{m as ItemForm};
@@ -1 +1 @@
1
- import"./shared-a84befbf.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as r}from"./shared-015da8ca.js";import{a as e}from"./shared-6d7c1a2f.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-d1195c27.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-e0c93cfa.js";import"./shared-08be5c32.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let a,s=r=>r;class t extends(e(r,"item-option-form")){static get v8n(){return[({name:r})=>!!r||"name:v8n_required",({name:r})=>!!r&&r.length<=100||"name:v8n_too_long",({value:r})=>!!r||"value:v8n_required",({value:r})=>!!r&&r.length<=1024||"value:v8n_too_long"]}renderBody(){return o(a||(a=s` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="value"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="mods"> <foxy-internal-number-control layout="summary-item" infer="price-mod"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="weight-mod"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),super.renderBody())}}customElements.define("foxy-item-option-form",t);export{t as ItemOptionForm};
1
+ import"./shared-d367ea04.js";import"./shared-91500a0f.js";import"./shared-bbc53ef2.js";import{I as r}from"./shared-0203d3da.js";import{a as e}from"./shared-6d7c1a2f.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-d1195c27.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-e0c93cfa.js";import"./shared-08be5c32.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let s,t=r=>r;class a extends(e(r,"item-option-form")){static get v8n(){return[({name:r})=>!!r||"name:v8n_required",({name:r})=>!!r&&r.length<=100||"name:v8n_too_long",({value:r})=>!!r||"value:v8n_required",({value:r})=>!!r&&r.length<=1024||"value:v8n_too_long"]}renderBody(){return o(s||(s=t` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="value"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="mods"> <foxy-internal-number-control layout="summary-item" infer="price-mod"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="weight-mod"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),super.renderBody())}}customElements.define("foxy-item-option-form",a);export{a as ItemOptionForm};
@@ -1 +1 @@
1
- import"./shared-0d43de87.js";import"./shared-4beb6fef.js";import"./shared-4f852fd5.js";import"./shared-c671d5c7.js";import"./shared-51efaf53.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-015da8ca.js";import{m as r,B as t,_ as o}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{h as a,s as n}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-f09454f9.js";import"./shared-5452fdfe.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-b14bf56d.js";import"./shared-ad3eea80.js";import"./shared-377e3168.js";import"./shared-78bfc71e.js";import"./shared-97627d50.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const l={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},s={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},_={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},c={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},d={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},f={service:"zapier",events:[],url:""},u={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let p,v,g,h,x,y,m,b,w,C,V,$,k,j,F=e=>e;const S=i(e,"native-integration-form");class G extends S{constructor(){super(...arguments),this.__createConfigGetterFor=r((e=>()=>{var r;return null===(r=this.__config)||void 0===r?void 0:r[e]})),this.__createConfigSetterFor=r((e=>r=>this.__config={[e]:r})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,r=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&r.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&r.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&r.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&r.push("use_ava_tax"),r},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,r;const t=null!==(r=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==r?r:{};return Object.entries(t).map((([e,r])=>({value:`${e}:${r}`})))},this.__codeMappingsSetValue=e=>{const r={};for(const{value:t}of e){const[e,o]=t.split(":");e&&o&&(r[e]=o)}this.__config={category_to_product_tax_code_mappings:r}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,r;return(null!==(r=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==r?r:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=r(JSON.parse),t=r((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==r||!a||`avalara-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).id||"avalara-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).key||"avalara-key:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).company_code||"avalara-company-code:v8n_required",({provider:r="avalara",config:t="{}"})=>{if("avalara"!==r)return!0;const o=e(t).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:r="avalara",config:t="{}"})=>"taxjar"!==r||!!e(t).api_token||"taxjar-api-token:v8n_required",({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==r||!a||`onesource-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).external_company_id||"onesource-external-company-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).from_city||"onesource-from-city:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).host_system||"onesource-host-system:v8n_required",({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:o,encryption_key:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"json"!==i||!n||`webhook-json-url:${n}`},({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_id||"webflow-site-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_name||"webflow-site-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_id||"webflow-collection-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_name||"webflow-collection-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new t(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const r=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(p||(p=F` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(v||(v=F` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===r?this.__renderAvalaraConfig():"taxjar"===r?this.__renderTaxJarConfig():"onesource"===r?this.__renderOneSourceConfig():"webflow"===r?this.__renderWebflowConfig():"zapier"===r?this.__renderZapierConfig():"webhook"===r?this.__renderWebhookConfig():"apple_pay"===r?this.__renderApplePayConfig():"custom_tax"===r?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var r;const t=this.__config,i=null!==(r=this.form.provider)&&void 0!==r?r:"avalara",a="avalara"===i?c:"taxjar"===i?u:"onesource"===i?_:"webflow"===i?d:"zapier"===i?f:"webhook"===i?"legacy_xml"===(null==t?void 0:t.service)?l:s:void 0,n=JSON.stringify(o(o(o({},a),t),e));this.edit({provider:i,config:n})}__renderAvalaraConfig(){var e;return a(g||(g=F` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(h||(h=F` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(x||(x=F` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=F` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,r;return a(m||(m=F` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),n(b||(b=F`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(r=this.__config)||void 0===r?void 0:r.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(w||(w=F` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(C||(C=F` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(V||(V=F` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"))}__renderZapierConfig(){return a($||($=F` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(k||(k=F` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a(j||(j=F` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",G);export{G as NativeIntegrationForm};
1
+ import"./shared-0d43de87.js";import"./shared-4beb6fef.js";import"./shared-4f852fd5.js";import"./shared-c671d5c7.js";import"./shared-51efaf53.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import{m as r,B as t,_ as o}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{h as a,s as n}from"./shared-dc73b9a5.js";import"./shared-7448fda4.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-f09454f9.js";import"./shared-5452fdfe.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-b14bf56d.js";import"./shared-ad3eea80.js";import"./shared-377e3168.js";import"./shared-78bfc71e.js";import"./shared-97627d50.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const l={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},s={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},_={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},c={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},d={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},f={service:"zapier",events:[],url:""},u={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let p,v,g,h,x,y,m,b,w,C,V,$,k,j,F=e=>e;const S=i(e,"native-integration-form");class G extends S{constructor(){super(...arguments),this.__createConfigGetterFor=r((e=>()=>{var r;return null===(r=this.__config)||void 0===r?void 0:r[e]})),this.__createConfigSetterFor=r((e=>r=>this.__config={[e]:r})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,r=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&r.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&r.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&r.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&r.push("use_ava_tax"),r},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,r;const t=null!==(r=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==r?r:{};return Object.entries(t).map((([e,r])=>({value:`${e}:${r}`})))},this.__codeMappingsSetValue=e=>{const r={};for(const{value:t}of e){const[e,o]=t.split(":");e&&o&&(r[e]=o)}this.__config={category_to_product_tax_code_mappings:r}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,r;return(null!==(r=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==r?r:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=r(JSON.parse),t=r((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==r||!a||`avalara-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).id||"avalara-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).key||"avalara-key:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).company_code||"avalara-company-code:v8n_required",({provider:r="avalara",config:t="{}"})=>{if("avalara"!==r)return!0;const o=e(t).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:r="avalara",config:t="{}"})=>"taxjar"!==r||!!e(t).api_token||"taxjar-api-token:v8n_required",({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==r||!a||`onesource-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).external_company_id||"onesource-external-company-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).from_city||"onesource-from-city:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).host_system||"onesource-host-system:v8n_required",({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:o,encryption_key:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"json"!==i||!n||`webhook-json-url:${n}`},({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_id||"webflow-site-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_name||"webflow-site-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_id||"webflow-collection-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_name||"webflow-collection-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new t(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const r=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(p||(p=F` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(v||(v=F` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===r?this.__renderAvalaraConfig():"taxjar"===r?this.__renderTaxJarConfig():"onesource"===r?this.__renderOneSourceConfig():"webflow"===r?this.__renderWebflowConfig():"zapier"===r?this.__renderZapierConfig():"webhook"===r?this.__renderWebhookConfig():"apple_pay"===r?this.__renderApplePayConfig():"custom_tax"===r?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var r;const t=this.__config,i=null!==(r=this.form.provider)&&void 0!==r?r:"avalara",a="avalara"===i?c:"taxjar"===i?u:"onesource"===i?_:"webflow"===i?d:"zapier"===i?f:"webhook"===i?"legacy_xml"===(null==t?void 0:t.service)?l:s:void 0,n=JSON.stringify(o(o(o({},a),t),e));this.edit({provider:i,config:n})}__renderAvalaraConfig(){var e;return a(g||(g=F` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(h||(h=F` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(x||(x=F` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=F` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,r;return a(m||(m=F` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),n(b||(b=F`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(r=this.__config)||void 0===r?void 0:r.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(w||(w=F` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(C||(C=F` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(V||(V=F` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"))}__renderZapierConfig(){return a($||($=F` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(k||(k=F` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a(j||(j=F` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",G);export{G as NativeIntegrationForm};
@@ -1 +1 @@
1
- import"./shared-51efaf53.js";import"./shared-bbc53ef2.js";import{I as r}from"./shared-015da8ca.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-6d7c1a2f.js";import{B as a}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-97627d50.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./shared-bab2ea2c.js";let d,o,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(o||(o=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(d||(d=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
1
+ import"./shared-51efaf53.js";import"./shared-bbc53ef2.js";import{I as r}from"./shared-0203d3da.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-6d7c1a2f.js";import{B as a}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-97627d50.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-61ade33e.js";import"./shared-359793d4.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-3bfbd5af.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-d1cb97c6.js";import"./shared-9803aa7c.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-bb9f0d8b.js";import"./shared-bab2ea2c.js";let d,o,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(o||(o=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(d||(d=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
@@ -1 +1 @@
1
- import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-51c4a6dd.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-3bfbd5af.js";import{_ as e,B as t}from"./shared-d1195c27.js";import{l as s,u as r}from"./shared-2bf89a21.js";import{C as a}from"./shared-d1cb97c6.js";import{T as i,a as o}from"./shared-6d7c1a2f.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c}from"./shared-dc73b9a5.js";import{i as l}from"./shared-9803aa7c.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-e8b8c8d0.js";import"./shared-e0c93cfa.js";import"./shared-08be5c32.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-57164953.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-fb18400f.js";import"./shared-b3d36746.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-2dd497e5.js";import"./shared-015da8ca.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./foxy-payment-card-embed.js";import"./shared-78bfc71e.js";import"./shared-ad3eea80.js";import"./shared-4b52b410.js";import"./shared-f09454f9.js";import"./shared-eecba1f5.js";import"./shared-0e156ee7.js";import"./shared-c2efc54e.js";const h=d("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),f=d(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${h} }`)).join(" "));let u,b,j,y,v,g,$,x,_,S,w=e=>e;const T=i(a(o(p,"payment-method-card")));class k extends T{constructor(){super(...arguments),this.embedUrl=null,this.__renderActionsUpdate=()=>{var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.save_cc),s=t?"--lumo-primary-text-color: #fff; --lumo-primary-color-50pct: rgba(255, 255, 255, 0.5); --lumo-contrast-5pct: rgba(255, 255, 255, 0.05)":void 0;return n(u||(u=w` <div class="flex"> ${0} <foxy-form-dialog data-testid="update-dialog" readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="status ${0}" header="${0}" group="${0}" form="foxy-update-payment-method-form" href="${0}" lang="${0}" ns="${0} dialog" alert close-on-patch .props="${0}"> </foxy-form-dialog> <vaadin-button class="${0}" theme="${0}" style="${0}" aria-label="${0}" data-testid="actions:update" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:update:before"),this.readonlySelector.zoom("actions:update:form"),this.disabledSelector.zoom("actions:update:form"),this.hiddenSelector.zoom("actions:update:form"),t?"dialog_header_update":"dialog_header_add",this.group,this.href,this.lang,this.ns,{".embedUrl":this.embedUrl},l(t?"px-xs rounded":void 0),t?"icon":"contrast small",l(s),this.t(t?"update":"add"),this.disabledSelector.matches("actions:update",!0),(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),n(t?b||(b=w`<iron-icon icon="icons:create"></iron-icon>`):j||(j=w`<foxy-i18n infer="" key="add"></foxy-i18n>`)),this.renderTemplateOrSlot("actions:update:after"))},this.__renderActionsDelete=()=>n(y||(y=w` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>{const e=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl,t=this.hiddenSelector.matches("actions:delete",!0);return n(v||(v=w` <div class="flex gap-s" data-testid="actions"> ${0} ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),e?"":this.__renderActionsUpdate(),t?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}}static get properties(){return e(e({},super.properties),{},{embedUrl:{attribute:"embed-url"}})}static get styles(){return[super.styles,f,c(g||(g=w`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var e,a,i,o,d,c;const{data:l,lang:p,ns:h}=this;if(this.in({idle:"template"})||!(null==l?void 0:l.save_cc)||!this.in("idle")){const t=this.in("fail")?"error":this.in("busy")?"busy":"empty",s=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl||!this.data;return n($||($=w` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex flex-col gap-m items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> ${0} </div> </div> `),this.in("busy"),t,this.lang,h,null!==(a=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==a?a:"",s?"":this.__renderActionsUpdate())}const f=null!==(o=null===(i=l.cc_type)||void 0===i?void 0:i.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=s[f])&&void 0!==d?d:r,b=null===(c=l.cc_number_masked)||void 0===c?void 0:c.substring(l.cc_number_masked.length-4);return n(x||(x=w` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> <div class="mr-auto rounded h-m">${0}</div> ${0} </div> <div class="font-tnum leading-none flex justify-between" style="color:#fff"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),p,h,this.__handleConfirmHide,this.in("busy"),f,m({"flex items-start":!0,"justify-between":this.readonlyControls===t.False,"justify-end":this.readonlyControls===t.True}),u,this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),l.cc_exp_month&&l.cc_exp_year?n(_||(_=w` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),l.cc_exp_month,l.cc_exp_year):"",b?n(S||(S=w` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),b):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return p.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",k);export{k as PaymentMethodCard};
1
+ import"./shared-5452fdfe.js";import"./shared-bb9f0d8b.js";import"./shared-935adc3b.js";import"./shared-c86db2c0.js";import"./shared-51c4a6dd.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-3bfbd5af.js";import{_ as e,B as t}from"./shared-d1195c27.js";import{l as s,u as r}from"./shared-2bf89a21.js";import{C as a}from"./shared-d1cb97c6.js";import{T as i,a as o}from"./shared-6d7c1a2f.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c}from"./shared-dc73b9a5.js";import{i as l}from"./shared-9803aa7c.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-e8b8c8d0.js";import"./shared-e0c93cfa.js";import"./shared-08be5c32.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-57164953.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-14179b23.js";import"./shared-b3d36746.js";import"./shared-7448fda4.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-2dd497e5.js";import"./shared-0203d3da.js";import"./foxy-copy-to-clipboard.js";import"./shared-dbe8536b.js";import"./shared-e231722c.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-b384e653.js";import"./shared-fd1adc35.js";import"./foxy-payment-card-embed.js";import"./shared-78bfc71e.js";import"./shared-ad3eea80.js";import"./shared-4b52b410.js";import"./shared-f09454f9.js";import"./shared-eecba1f5.js";import"./shared-0e156ee7.js";import"./shared-c2efc54e.js";const h=d("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),f=d(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${h} }`)).join(" "));let u,b,j,y,v,g,$,x,_,S,w=e=>e;const T=i(a(o(p,"payment-method-card")));class k extends T{constructor(){super(...arguments),this.embedUrl=null,this.__renderActionsUpdate=()=>{var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.save_cc),s=t?"--lumo-primary-text-color: #fff; --lumo-primary-color-50pct: rgba(255, 255, 255, 0.5); --lumo-contrast-5pct: rgba(255, 255, 255, 0.05)":void 0;return n(u||(u=w` <div class="flex"> ${0} <foxy-form-dialog data-testid="update-dialog" readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="status ${0}" header="${0}" group="${0}" form="foxy-update-payment-method-form" href="${0}" lang="${0}" ns="${0} dialog" alert close-on-patch .props="${0}"> </foxy-form-dialog> <vaadin-button class="${0}" theme="${0}" style="${0}" aria-label="${0}" data-testid="actions:update" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:update:before"),this.readonlySelector.zoom("actions:update:form"),this.disabledSelector.zoom("actions:update:form"),this.hiddenSelector.zoom("actions:update:form"),t?"dialog_header_update":"dialog_header_add",this.group,this.href,this.lang,this.ns,{".embedUrl":this.embedUrl},l(t?"px-xs rounded":void 0),t?"icon":"contrast small",l(s),this.t(t?"update":"add"),this.disabledSelector.matches("actions:update",!0),(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),n(t?b||(b=w`<iron-icon icon="icons:create"></iron-icon>`):j||(j=w`<foxy-i18n infer="" key="add"></foxy-i18n>`)),this.renderTemplateOrSlot("actions:update:after"))},this.__renderActionsDelete=()=>n(y||(y=w` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>{const e=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl,t=this.hiddenSelector.matches("actions:delete",!0);return n(v||(v=w` <div class="flex gap-s" data-testid="actions"> ${0} ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),e?"":this.__renderActionsUpdate(),t?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}}static get properties(){return e(e({},super.properties),{},{embedUrl:{attribute:"embed-url"}})}static get styles(){return[super.styles,f,c(g||(g=w`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var e,a,i,o,d,c;const{data:l,lang:p,ns:h}=this;if(this.in({idle:"template"})||!(null==l?void 0:l.save_cc)||!this.in("idle")){const t=this.in("fail")?"error":this.in("busy")?"busy":"empty",s=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl||!this.data;return n($||($=w` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex flex-col gap-m items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> ${0} </div> </div> `),this.in("busy"),t,this.lang,h,null!==(a=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==a?a:"",s?"":this.__renderActionsUpdate())}const f=null!==(o=null===(i=l.cc_type)||void 0===i?void 0:i.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=s[f])&&void 0!==d?d:r,b=null===(c=l.cc_number_masked)||void 0===c?void 0:c.substring(l.cc_number_masked.length-4);return n(x||(x=w` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> <div class="mr-auto rounded h-m">${0}</div> ${0} </div> <div class="font-tnum leading-none flex justify-between" style="color:#fff"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),p,h,this.__handleConfirmHide,this.in("busy"),f,m({"flex items-start":!0,"justify-between":this.readonlyControls===t.False,"justify-end":this.readonlyControls===t.True}),u,this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),l.cc_exp_month&&l.cc_exp_year?n(_||(_=w` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),l.cc_exp_month,l.cc_exp_year):"",b?n(S||(S=w` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),b):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return p.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",k);export{k as PaymentMethodCard};
@@ -1 +1 @@
1
- import"./shared-935adc3b.js";import"./shared-a84befbf.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-015da8ca.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,aM as o,l as a}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-1aff7995.js";import{h as c}from"./shared-56ba2d28.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let p,h,f,u,m,v,b,j,y,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(p||(p=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(h||(h=P``)):l(f||(f=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(b||(b=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(j||(j=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(y||(y=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,p=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,p,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,p,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,p,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
1
+ import"./shared-935adc3b.js";import"./shared-d367ea04.js";import"./shared-6a8ccf0c.js";import"./shared-91500a0f.js";import"./shared-53443b27.js";import"./shared-bbc53ef2.js";import{I as e}from"./shared-0203d3da.js";import"./foxy-nucleon-element.js";import"./shared-3bfbd5af.js";import{_ as t,B as r,aM as o,l as a}from"./shared-d1195c27.js";import{a as i}from"./shared-6d7c1a2f.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-1aff7995.js";import{h as c}from"./shared-56ba2d28.js";import"./shared-08be5c32.js";import"./shared-e0c93cfa.js";import"./shared-359793d4.js";import"./shared-61ade33e.js";import"./shared-2dd497e5.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-17a61265.js";import"./shared-e8b8c8d0.js";import"./shared-c518ece2.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-dbe8536b.js";import"./shared-5452fdfe.js";import"./shared-e231722c.js";import"./shared-838bd79c.js";import"./shared-ad3eea80.js";import"./shared-78bfc71e.js";import"./shared-377e3168.js";import"./shared-f09454f9.js";import"./shared-3493737e.js";import"./shared-6be8e65e.js";import"./shared-c24bc616.js";import"./shared-b2bc3a0e.js";import"./shared-4b52b410.js";import"./shared-651c44fa.js";import"./shared-455856d9.js";import"./shared-317cb721.js";import"./shared-22ba9566.js";import"./shared-c86db2c0.js";import"./shared-57164953.js";import"./foxy-copy-to-clipboard.js";import"./shared-bb9f0d8b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let p,h,f,u,m,v,b,j,y,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(p||(p=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(h||(h=P``)):l(f||(f=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(b||(b=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(j||(j=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(y||(y=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,p=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,p,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,p,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,p,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};