@foxy.io/elements 1.33.0 → 1.34.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/translations/template-config-form/en.json +1 -1
- package/dist/cdn/translations/webhook-form/en.json +30 -25
- package/dist/elements/public/SignInForm/SignInForm.d.ts +3 -0
- package/dist/elements/public/SignInForm/SignInForm.js +22 -0
- package/dist/elements/public/SignInForm/SignInForm.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.d.ts +5 -1
- package/dist/elements/public/WebhookForm/WebhookForm.js +50 -30
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/dist/elements/public/WebhookForm/index.d.ts +3 -1
- package/dist/elements/public/WebhookForm/index.js +3 -1
- package/dist/elements/public/WebhookForm/index.js.map +1 -1
- package/dist/elements/public/WebhookForm/types.d.ts +2 -0
- package/dist/elements/public/WebhookForm/types.js.map +1 -1
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.d.ts +4 -0
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.js +17 -5
- package/dist/elements/public/WebhookLogCard/WebhookLogCard.js.map +1 -1
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.d.ts +4 -0
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.js +25 -16
- package/dist/elements/public/WebhookStatusCard/WebhookStatusCard.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-9dd252c7.js";import"./shared-47fe9f56.js";import"./shared-136942c7.js";import"./shared-57373d84.js";import{I as r}from"./shared-e8744e04.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-684174e7.js";import"./shared-0d4cdb19.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-70612035.js";import"./shared-ff10b9fb.js";import"./shared-6583e3f9.js";import"./shared-6b578d1a.js";import"./shared-08e73812.js";import"./shared-b8ae5af7.js";import"./shared-61ade33e.js";import"./shared-83c8a2d2.js";import"./shared-2dd2ff95.js";import"./shared-95a591b3.js";import"./shared-433ff5ae.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-52c9fa57.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-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-46189aae.js";import"./shared-705ce87a.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-3ef5dcef.js";import"./shared-25b83adb.js";import"./shared-8d826ccb.js";import"./shared-cc8ce493.js";import"./shared-3db18172.js";import"./shared-f6f4bed5.js";import"./shared-7edf38e9.js";import"./shared-f79438f8.js";import"./shared-f4e03cdc.js";import"./shared-651c44fa.js";import"./shared-56ee26d7.js";import"./shared-a9b8c3ab.js";import"./shared-8d5b9662.js";import"./shared-5cdec81e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-66e2a4ee.js";import"./shared-a1f697c2.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-ccc7a886.js";import"./shared-6b5e4fe4.js";import"./shared-77135874.js";import"./shared-cb24170b.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-69cdc370.js";import"./foxy-custom-field-card.js";import"./shared-2aee2a22.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-1d0d814b.js";import"./shared-4f33425a.js";import"./shared-a2616e4b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./
|
|
1
|
+
import"./shared-9dd252c7.js";import"./shared-47fe9f56.js";import"./shared-136942c7.js";import"./shared-57373d84.js";import{I as r}from"./shared-e8744e04.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-684174e7.js";import"./shared-0d4cdb19.js";import{_ as t,B as e}from"./shared-d1195c27.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-70612035.js";import"./shared-ff10b9fb.js";import"./shared-6583e3f9.js";import"./shared-6b578d1a.js";import"./shared-08e73812.js";import"./shared-b8ae5af7.js";import"./shared-61ade33e.js";import"./shared-83c8a2d2.js";import"./shared-2dd2ff95.js";import"./shared-95a591b3.js";import"./shared-433ff5ae.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-52c9fa57.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-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-46189aae.js";import"./shared-705ce87a.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-3ef5dcef.js";import"./shared-25b83adb.js";import"./shared-8d826ccb.js";import"./shared-cc8ce493.js";import"./shared-3db18172.js";import"./shared-f6f4bed5.js";import"./shared-7edf38e9.js";import"./shared-f79438f8.js";import"./shared-f4e03cdc.js";import"./shared-651c44fa.js";import"./shared-56ee26d7.js";import"./shared-a9b8c3ab.js";import"./shared-8d5b9662.js";import"./shared-5cdec81e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-66e2a4ee.js";import"./shared-a1f697c2.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-ccc7a886.js";import"./shared-6b5e4fe4.js";import"./shared-77135874.js";import"./shared-cb24170b.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-69cdc370.js";import"./foxy-custom-field-card.js";import"./shared-2aee2a22.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-641786b2.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-1d0d814b.js";import"./shared-4f33425a.js";import"./shared-67d1de9a.js";import"./shared-148214ee.js";import"./shared-a2616e4b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-1acbd965.js";import"./foxy-item-form.js";import"./shared-b73aaedb.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-8a65adfd.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends o{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const a=new URL(null!==(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==o?o:"");"cancel"===this.action&&a.searchParams.set("sub_cancel","true"),e=a.toString()}catch(r){e=void 0}return s(d||(d=m` <a target="_blank" class="rounded font-medium text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="caption"> </foxy-i18n> </a> `),a(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends o{renderControl(){var r,o;return s(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<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>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,j=r=>r;const u=n(r,"admin-subscription-form");class y extends u{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return s(p||(p=j` <foxy-internal-admin-subscription-form-load-in-cart-action infer="view-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> <foxy-internal-admin-subscription-form-load-in-cart-action action="cancel" infer="cancel-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> `))}renderBody(){var r,o,t,e,i;let n;try{const t=new URL(null!==(o=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==o?o:"");t.searchParams.set("zoom","items"),n=t.toString()}catch(r){n=void 0}return s(h||(h=j` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),a(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),a(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),a(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-a8f38962.js";import"./shared-cc8ce493.js";import"./shared-4f33425a.js";import"./shared-b8ae5af7.js";import"./shared-433ff5ae.js";import"./shared-ff10b9fb.js";import"./shared-6b578d1a.js";import"./shared-a1f697c2.js";import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-0d4cdb19.js";import{_ as e}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import{C as r}from"./shared-d1cb97c6.js";import{N as i}from"./shared-e8b8c8d0.js";import{T as o,a as n}from"./shared-70612035.js";import{c as a}from"./shared-4e709717.js";import{i as s}from"./shared-9803aa7c.js";import{v as d}from"./shared-b738ee96.js";import"./shared-6583e3f9.js";import"./shared-3db18172.js";import"./shared-25b83adb.js";import"./shared-8d826ccb.js";import"./shared-61ade33e.js";import"./shared-08e73812.js";import"./shared-52c9fa57.js";import"./shared-17a61265.js";import"./shared-343d1fd7.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";!function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var i,o;void 0===(o="function"==typeof(i=function(){for(var e=[null,[[10,7,17,13],[1,1,1,1],[]],[[16,10,28,22],[1,1,1,1],[4,16]],[[26,15,22,18],[1,1,2,2],[4,20]],[[18,20,16,26],[2,1,4,2],[4,24]],[[24,26,22,18],[2,1,4,4],[4,28]],[[16,18,28,24],[4,2,4,4],[4,32]],[[18,20,26,18],[4,2,5,6],[4,20,36]],[[22,24,26,22],[4,2,6,6],[4,22,40]],[[22,30,24,20],[5,2,8,8],[4,24,44]],[[26,18,28,24],[5,4,8,8],[4,26,48]],[[30,20,24,28],[5,4,11,8],[4,28,52]],[[22,24,28,26],[8,4,11,10],[4,30,56]],[[22,26,22,24],[9,4,16,12],[4,32,60]],[[24,30,24,20],[9,4,16,16],[4,24,44,64]],[[24,22,24,30],[10,6,18,12],[4,24,46,68]],[[28,24,30,24],[10,6,16,17],[4,24,48,72]],[[28,28,28,28],[11,6,19,16],[4,28,52,76]],[[26,30,28,28],[13,6,21,18],[4,28,54,80]],[[26,28,26,26],[14,7,25,21],[4,28,56,84]],[[26,28,28,30],[16,8,25,20],[4,32,60,88]],[[26,28,30,28],[17,8,25,23],[4,26,48,70,92]],[[28,28,24,30],[17,9,34,23],[4,24,48,72,96]],[[28,30,30,30],[18,9,30,25],[4,28,52,76,100]],[[28,30,30,30],[20,10,32,27],[4,26,52,78,104]],[[28,26,30,30],[21,12,35,29],[4,30,56,82,108]],[[28,28,30,28],[23,12,37,34],[4,28,56,84,112]],[[28,30,30,30],[25,12,40,34],[4,32,60,88,116]],[[28,30,30,30],[26,13,42,35],[4,24,48,72,96,120]],[[28,30,30,30],[28,14,45,38],[4,28,52,76,100,124]],[[28,30,30,30],[29,15,48,40],[4,24,50,76,102,128]],[[28,30,30,30],[31,16,51,43],[4,28,54,80,106,132]],[[28,30,30,30],[33,17,54,45],[4,32,58,84,110,136]],[[28,30,30,30],[35,18,57,48],[4,28,56,84,112,140]],[[28,30,30,30],[37,19,60,51],[4,32,60,88,116,144]],[[28,30,30,30],[38,19,63,53],[4,28,52,76,100,124,148]],[[28,30,30,30],[40,20,66,56],[4,22,48,74,100,126,152]],[[28,30,30,30],[43,21,70,59],[4,26,52,78,104,130,156]],[[28,30,30,30],[45,22,74,62],[4,30,56,82,108,134,160]],[[28,30,30,30],[47,24,77,65],[4,24,52,80,108,136,164]],[[28,30,30,30],[49,25,81,68],[4,28,56,84,112,140,168]]],t=/^\d*$/,r=/^[A-Za-z0-9 $%*+\-./:]*$/,i=/^[A-Z0-9 $%*+\-./:]*$/,o=[],n=[-1],a=0,s=1;a<255;++a)o.push(s),n[s]=a,s=2*s^(s>=128?285:0);var d=[[]];for(a=0;a<30;++a){for(var l=d[a],u=[],c=0;c<=a;++c){var f=c<a?o[l[c]]:0,h=o[(a+(l[c-1]||0))%255];u.push(n[f^h])}d.push(u)}var p={};for(a=0;a<45;++a)p["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".charAt(a)]=a;var m=[function(e,t){return(e+t)%2==0},function(e,t){return e%2==0},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return((e/2|0)+(t/3|0))%2==0},function(e,t){return e*t%2+e*t%3==0},function(e,t){return(e*t%2+e*t%3)%2==0},function(e,t){return((e+t)%2+e*t%3)%2==0}],v=function(e){return e>6},b=function(t,r){var i=-8&function(t){var r=e[t],i=16*t*t+128*t+64;return v(t)&&(i-=36),r[2].length&&(i-=25*r[2].length*r[2].length-10*r[2].length-55),i}(t),o=e[t];return i-8*o[0][r]*o[1][r]},g=function(e,t){switch(t){case 1:return e<10?10:e<27?12:14;case 2:return e<10?9:e<27?11:13;case 4:return e<10?8:16;case 8:return e<10?8:e<27?10:12}},y=function(e,t,r){var i=b(e,r)-4-g(e,t);switch(t){case 1:return 3*(i/10|0)+(i%10<4?0:i%10<7?1:2);case 2:return 2*(i/11|0)+(i%11<6?0:1);case 4:return i/8|0;case 8:return i/13|0}},_=function(e,t){for(var r=e.slice(0),i=e.length,a=t.length,s=0;s<a;++s)r.push(0);for(s=0;s<i;){var d=n[r[s++]];if(d>=0)for(var l=0;l<a;++l)r[s+l]^=o[(d+t[l])%255]}return r.slice(i)},w=function(e,t,r,i){for(var o=e<<i,n=t-1;n>=0;--n)o>>i+n&1&&(o^=r<<n);return e<<i|o},$=function(e,t,r){for(var i=m[r],o=e.length,n=0;n<o;++n)for(var a=0;a<o;++a)t[n][a]||(e[n][a]^=i(n,a));return e},S=function(e,t,r,i){for(var o=e.length,n=21522^w(r<<3|i,5,1335,10),a=0;a<15;++a){var s=[o-1,o-2,o-3,o-4,o-5,o-6,o-7,o-8,7,5,4,3,2,1,0][a];e[[0,1,2,3,4,5,7,8,o-7,o-6,o-5,o-4,o-3,o-2,o-1][a]][8]=e[8][s]=n>>a&1}return e},x=function(e){for(var t=function(e){for(var t=0,r=0;r<e.length;++r)e[r]>=5&&(t+=e[r]-5+3);for(r=5;r<e.length;r+=2){var i=e[r];e[r-1]==i&&e[r-2]==3*i&&e[r-3]==i&&e[r-4]==i&&(e[r-5]>=4*i||e[r+1]>=4*i)&&(t+=40)}return t},r=e.length,i=0,o=0,n=0;n<r;++n){var a,s=e[n];a=[0];for(var d=0;d<r;){for(l=0;d<r&&s[d];++l)++d;for(a.push(l),l=0;d<r&&!s[d];++l)++d;a.push(l)}for(i+=t(a),a=[0],d=0;d<r;){var l;for(l=0;d<r&&e[d][n];++l)++d;for(a.push(l),l=0;d<r&&!e[d][n];++l)++d;a.push(l)}i+=t(a);var u=e[n+1]||[];for(o+=s[0],d=1;d<r;++d){var c=s[d];o+=c,s[d-1]==c&&u[d]===c&&u[d-1]===c&&(i+=3)}}return i+10*(Math.abs(o/r/r-.5)/.05|0)},j=function(t,r,i,o,n){var a=e[r],s=function(e,t,r,i){var o=[],n=0,a=8,s=r.length,d=function(e,t){if(t>=a){for(o.push(n|e>>(t-=a));t>=8;)o.push(e>>(t-=8)&255);n=0,a=8}t>0&&(n|=(e&(1<<t)-1)<<(a-=t))},l=g(e,t);switch(d(t,4),d(s,l),t){case 1:for(var u=2;u<s;u+=3)d(parseInt(r.substring(u-2,u+1),10),10);d(parseInt(r.substring(u-2),10),[0,4,7][s%3]);break;case 2:for(u=1;u<s;u+=2)d(45*p[r.charAt(u-1)]+p[r.charAt(u)],11);s%2==1&&d(p[r.charAt(u-1)],6);break;case 4:for(u=0;u<s;++u)d(r[u],8)}for(d(0,4),a<8&&o.push(n);o.length+1<i;)o.push(236,17);return o.length<i&&o.push(236),o}(r,i,t,b(r,o)>>3);s=function(e,t,r){for(var i=[],o=e.length/t|0,n=0,a=t-e.length%t,s=0;s<a;++s)i.push(n),n+=o;for(s=a;s<t;++s)i.push(n),n+=o+1;i.push(n);var d=[];for(s=0;s<t;++s)d.push(_(e.slice(i[s],i[s+1]),r));var l=[],u=e.length/t|0;for(s=0;s<u;++s)for(var c=0;c<t;++c)l.push(e[i[c]+s]);for(c=a;c<t;++c)l.push(e[i[c+1]-1]);for(s=0;s<r.length;++s)for(c=0;c<t;++c)l.push(d[c][s]);return l}(s,a[1][o],d[a[0][o]]);var l=function(t){for(var r=e[t],i=function(e){return 4*e+17}(t),o=[],n=[],a=0;a<i;++a)o.push([]),n.push([]);var s=function(e,t,r,i,a){for(var s=0;s<r;++s)for(var d=0;d<i;++d)o[e+s][t+d]=a[s]>>d&1,n[e+s][t+d]=1};for(s(0,0,9,9,[127,65,93,93,93,65,383,0,64]),s(i-8,0,8,9,[256,127,65,93,93,93,65,127]),s(0,i-8,9,8,[254,130,186,186,186,130,254,0,0]),a=9;a<i-8;++a)o[6][a]=o[a][6]=1&~a,n[6][a]=n[a][6]=1;var d=r[2],l=d.length;for(a=0;a<l;++a)for(var u=0==a?l-1:l,c=0==a||a==l-1?1:0;c<u;++c)s(d[a],d[c],5,5,[31,17,21,17,31]);if(v(t)){var f=w(t,6,7973,12),h=0;for(a=0;a<6;++a)for(c=0;c<3;++c)o[a][i-11+c]=o[i-11+c][a]=f>>h++&1,n[a][i-11+c]=n[i-11+c][a]=1}return{matrix:o,reserved:n}}(r),u=l.matrix,c=l.reserved;if(function(e,t,r){for(var i=e.length,o=0,n=-1,a=i-1;a>=0;a-=2){6==a&&--a;for(var s=n<0?i-1:0,d=0;d<i;++d){for(var l=a;l>a-2;--l)t[s][l]||(e[s][l]=r[o>>3]>>(7&~o)&1,++o);s+=n}n=-n}}(u,c,s),n<0){$(u,c,0),S(u,0,o,0);var f=0,h=x(u);for($(u,c,0),n=1;n<8;++n){$(u,c,n),S(u,0,o,n);var m=x(u);h>m&&(h=m,f=n),$(u,c,n)}n=f}return $(u,c,n),S(u,0,o,n),u},k={generate:function(e,o){var n=(o=o||{}).version||-1,a={L:1,M:0,Q:3,H:2}[(o.ecclevel||"L").toUpperCase()],s=o.mode?{numeric:1,alphanumeric:2,octet:4}[o.mode.toLowerCase()]:-1,d="mask"in o?o.mask:-1;if(s<0)s="string"==typeof e?e.match(t)?1:e.match(i)?2:4:4;else if(1!=s&&2!=s&&4!=s)throw"invalid or unsupported mode";if(null===(e=function(e,i){switch(e){case 1:return i.match(t)?i:null;case 2:return i.match(r)?i.toUpperCase():null;case 4:if("string"==typeof i){for(var o=[],n=0;n<i.length;++n){var a=i.charCodeAt(n);a<128?o.push(a):a<2048?o.push(192|a>>6,128|63&a):a<65536?o.push(224|a>>12,128|a>>6&63,128|63&a):o.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|63&a)}return o}return i}}(s,e)))throw"invalid data format";if(a<0||a>3)throw"invalid ECC level";if(n<0){for(n=1;n<=40&&!(e.length<=y(n,s,a));++n);if(n>40)throw"too large data"}else if(n<1||n>40)throw"invalid version";if(-1!=d&&(d<0||d>8))throw"invalid mask";return j(e,n,s,a,d)},generateHTML:function(e,t){t=t||{};for(var r=k.generate(e,t),i=Math.max(t.modulesize||5,.5),o=t.unit||"px",n=t.ratio||1,a=Math.max(null!==t.margin?t.margin:4,0),s=document.createElement("div"),d=r.length,l=['<table border="0" cellspacing="0" cellpadding="0" style="border:'+i*a+'px solid #fff;background:#fff">'],u=0;u<d;++u){l.push("<tr>");for(var c=0;c<d;++c){const e="px"!==o?"width:"+i*n+o+"; height:"+i*n+o:"width:"+i+"px;height:"+i+"px";console.log("generateHTML",{unit:o,ratio:n,modsize:i,size:e}),l.push('<td style="'+e+(r[u][c]?";background:#000":"")+'" part="'+(r[u][c]?"module-fg":"module-bg")+'" ></td>')}l.push("</tr>")}return s.className="qrcode",s.innerHTML=l.join("")+"</table>",s},generateSVG:function(e,t){t=t||{};var r=k.generate(e,t),i=r.length,o=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=o*(i+2*n),s=' class= "fg" width="'+o+'" height="'+o+'"/>',d=document.createElementNS("http://www.w3.org/2000/svg","svg");d.setAttribute("viewBox","0 0 "+a+" "+a),d.setAttribute("style","shape-rendering:crispEdges"),t.modulesize&&(d.setAttribute("width",a),d.setAttribute("height",a));for(var l=["<style scoped>.bg{fill:#FFF}.fg{fill:#000}</style>",'<rect class="bg" x="0" y="0"','width="'+a+'" height="'+a+'"/>'],u=n*o,c=0;c<i;++c){for(var f=n*o,h=0;h<i;++h)r[c][h]&&l.push('<rect x="'+f+'" y="'+u+'"',s),f+=o;u+=o}return d.innerHTML=l.join(""),d},generatePNG:function(e,t){t=t||{};var r,i=k.generate(e,t),o=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=i.length,s=o*(a+2*n),d=document.createElement("canvas");if(d.width=d.height=s,!(r=d.getContext("2d")))throw"canvas support is needed for PNG output";r.fillStyle="#fff",r.fillRect(0,0,s,s),r.fillStyle="#000";for(var l=0;l<a;++l)for(var u=0;u<a;++u)i[l][u]&&r.fillRect(o*(n+u),o*(n+l),o,o);return d.toDataURL()}};return k})?i.apply(t,[]):i)||(e.exports=o)},function(e,t,r){r.r(t);var i=r(0),o=r.n(i);function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!==n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===n(o)?o:String(o)),i)}var o}function s(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return u(e,arguments,h(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),f(i,e)})(e)}function u(e,t,r){return(u=c()?Reflect.construct.bind():function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&f(o,r.prototype),o}).apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(p,e);var t,r,i,n,l,u=(t=p,r=c(),function(){var e,i=h(t);if(r){var o=h(this).constructor;e=Reflect.construct(i,arguments,o)}else e=i.apply(this,arguments);return s(this,e)});function p(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(e=u.call(this))._defineProperty=e._defineProperty.bind(d(e)),e.attachShadow({mode:"open"}),Object.keys(p.defaultAttributes).map(e._defineProperty),e}return i=p,l=[{key:"defaultAttributes",get:function(){return{data:null,format:"png",modulesize:5,margin:4,unit:"px",ratio:1}}},{key:"observedAttributes",get:function(){return Object.keys(p.defaultAttributes)}}],(n=[{key:"attributeChangedCallback",value:function(e,t,r){var i=this[e+"Changed"];i&&"function"==typeof i&&i.call(this,t,r),this.generate()}},{key:"_defineProperty",value:function(e){var t=this;Object.defineProperty(this,e,{get:function(){var r=t.getAttribute(e);return null===r?p.defaultAttributes[e]:r},set:function(r){t.setAttribute(e,r)}})}},{key:"getOptions",value:function(){var e=this.modulesize,t=this.margin,r=this.unit,i=this.ratio;return{margin:null!==t?parseInt(t):t,modulesize:null!==e?parseInt(e):e,unit:r||"px",ratio:i||1}}},{key:"generate",value:function(){try{this.clear(),null!==this.data?"png"===this.format?this.generatePNG():"html"===this.format?this.generateHTML():"svg"===this.format?this.generateSVG():this.shadowRoot.textContent="qr-code: ".concat(this.format," not supported!"):this.shadowRoot.textContent="qr-code: no data!"}catch(e){console.error(e),this.shadowRoot.textContent="qr-code: error!"}}},{key:"generatePNG",value:function(){var e=document.createElement("img");e.src=o.a.generatePNG(this.data,this.getOptions()),e.setAttribute("part","img"),this.shadowRoot.appendChild(e)}},{key:"generateHTML",value:function(){var e=o.a.generateHTML(this.data,this.getOptions()).firstChild;e.setAttribute("part","table"),this.shadowRoot.appendChild(e)}},{key:"generateSVG",value:function(){var e=o.a.generateSVG(this.data,this.getOptions());e.setAttribute("part","svg"),this.shadowRoot.appendChild(e)}},{key:"clear",value:function(){for(;this.shadowRoot.lastChild;)this.shadowRoot.removeChild(this.shadowRoot.lastChild)}}])&&a(i.prototype,n),l&&a(i,l),Object.defineProperty(i,"prototype",{writable:!1}),p}(l(HTMLElement));customElements.get("qr-code")||customElements.define("qr-code",p)}]);let l,u,c,f,h,p,m,v,b,g=e=>e;const y=o(r(n(i,"sign-in-form")));class _ extends y{constructor(){super(...arguments),this.issuer="Unknown",this.__emailValidator=()=>!this.errors.some((e=>e.startsWith("email"))),this.__passwordValidator=()=>!this.errors.some((e=>e.startsWith("password"))),this.__newPasswordValidator=()=>!this.errors.some((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),this.__mfaTotpCodeValidator=()=>!this.errors.some((e=>e.startsWith("mfa_totp_code")&&!e.endsWith("_error"))),this.__renderEmail=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("email"))),a=null==n?void 0:n.replace("email","v8n"),d=a?this.t(a).toString():"",u=this.in("busy");return t(l||(l=g` <div> ${0} <vaadin-email-field error-message="${0}" data-testid="email" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-email-field> ${0} </div> `),this.renderTemplateOrSlot("email:before"),d,this.t("email").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.email),u||r.matches("email",!0),i.matches("email",!0),this.__emailValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=e.target.value,o=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.password)&&void 0!==r?r:"";this.edit({credential:{email:i,password:o},type:"password"})}),this.renderTemplateOrSlot("email:after"))},this.__renderPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("password"))),a=null==n?void 0:n.replace("password","v8n"),d=a?this.t(a).toString():"",l=this.in("busy");return t(u||(u=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("password:before"),d,this.t("password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.password),l||r.matches("password",!0),i.matches("password",!0),this.__passwordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",o=e.target.value;this.edit({credential:{email:i,password:o},type:"password"})}),this.renderTemplateOrSlot("password:after"))},this.__renderNewPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),a=null==n?void 0:n.replace("new_password","v8n"),d=a?this.t(a).toString():"",l=this.in("busy");return t(c||(c=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="new-password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("new-password:before"),d,this.t("new_password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.new_password),l||r.matches("new-password",!0),i.matches("new-password",!0),this.__newPasswordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r,i,o;this.edit({type:"password",credential:{email:null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",password:null!==(o=null===(i=this.form.credential)||void 0===i?void 0:i.password)&&void 0!==o?o:"",new_password:e.target.value}})}),this.renderTemplateOrSlot("new-password:after"))},this.__renderMfaTotpCode=()=>{var r;const{disabledSelector:i,readonlySelector:o,errors:n}=this,a=this.__mfaSecretCode,d="mfa_totp_code",l="mfa-totp-code",u=n.find((e=>e.startsWith(d)&&!e.endsWith("_error"))),c=null==u?void 0:u.replace(d,"v8n"),h=c?this.t(c).toString():"",p=this.in("busy");return t(f||(f=g` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="123456" data-testid="${0}" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" autofocus @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${l}:before`),h,a?this.t("mfa_totp_code_hint"):"",l,this.t(d).toString(),s(null===(r=this.form.credential)||void 0===r?void 0:r.mfa_totp_code),p||i.matches(l,!0),o.matches(l,!0),this.__mfaTotpCodeValidator,(e=>"Enter"===e.key&&this.submit()),(t=>{const r=t.target.value,i=e(e({},this.form.credential),{},{mfa_totp_code:r});a&&(i.mfa_secret_code=a),this.edit({type:"password",credential:i})}),this.renderTemplateOrSlot(`${l}:after`))},this.__renderMfaSecretCode=()=>{var e,r;const i="mfa-secret-code",o=this.__mfaSecretCode,n=encodeURIComponent(this.issuer),a=encodeURIComponent(null!==(r=null===(e=this.form.credential)||void 0===e?void 0:e.email)&&void 0!==r?r:""),s=new URL(`otpauth://totp/${n}:${a}`);return s.searchParams.set("secret",o),s.searchParams.set("issuer",this.issuer),t(h||(h=g` <div> ${0} <div data-testid="${0}" class="flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10" style="background:#fff;color:#000"> <qr-code modulesize="2" margin="0" format="svg" class="inline-flex" data="${0}"> </qr-code> <div class="break-all font-medium leading-s text-xs tracking-widest"> ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),i,s.toString(),o,this.renderTemplateOrSlot(`${i}:after`))},this.__renderMfaRememberDevice=()=>{var r;const{__mfaSecretCode:i,form:o,lang:n,ns:a}=this,s="mfa-remember-device",d=this.in("busy")||this.disabledSelector.matches(s,!0);return t(p||(p=g` <div> ${0} <vaadin-checkbox data-testid="${0}" class="mb-m" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block" lang="${0}" key="mfa_remember_device" ns="${0}"></foxy-i18n> <foxy-i18n class="block text-xs ${0}" lang="${0}" key="mfa_remember_device_hint" ns="${0}"> </foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),s,d,!!(null===(r=o.credential)||void 0===r?void 0:r.mfa_remember_device),(t=>{var r,n;const a=t.currentTarget,s=e(e({},o.credential),{},{mfa_remember_device:a.checked,mfa_totp_code:null!==(n=null===(r=o.credential)||void 0===r?void 0:r.mfa_totp_code)&&void 0!==n?n:""});i&&(s.mfa_secret_code=i),this.edit({credential:s})}),n,a,d?"text-disabled":"text-secondary",n,a,this.renderTemplateOrSlot(`${s}:after`))},this.__renderError=()=>t(m||(m=g` <div> ${0} <p class="leading-s flex items-start text-s rounded p-s bg-error-10 text-error"> <iron-icon class="flex-shrink-0 mr-s icon-inline text-l" icon="lumo:error"></iron-icon> <foxy-i18n data-testid="error" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </p> ${0} </div> `),this.renderTemplateOrSlot("error:before"),this.lang,this.errors[0],this.ns,this.renderTemplateOrSlot("error:after")),this.__renderSubmit=()=>{const e=this.in({idle:{snapshot:{dirty:"valid"}}})||this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{template:{dirty:"valid"}}})||this.in({idle:{template:{clean:"valid"}}});return t(v||(v=g` <div> ${0} <vaadin-button data-testid="submit" class="w-full mt-m" theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="sign_in"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!e||this.in("busy")||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get properties(){return e(e({},super.properties),{},{issuer:{type:String}})}static get v8n(){return[({credential:e})=>!!(null==e?void 0:e.email)||"email_required",({credential:e})=>{var t;return d(null!==(t=null==e?void 0:e.email)&&void 0!==t?t:"")||"email_invalid_email"},({credential:e})=>!!(null==e?void 0:e.password)||"password_required",({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.new_password)||void 0===t?void 0:t.length)||"new_password_required"},({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.mfa_totp_code)||void 0===t?void 0:t.length)||"mfa_totp_code_required"}]}render(){var e,r,i,o;const{hiddenSelector:n,errors:s,lang:d,form:l,ns:u}=this,c=this.__mfaSecretCode,f=null===(e=l.credential)||void 0===e?void 0:e.mfa_totp_code,h=!!c||!!f||s.some((e=>e.startsWith("mfa"))),p="string"==typeof(null===(r=this.form.credential)||void 0===r?void 0:r.new_password)||s.some((e=>e.startsWith("new_password_"))),m=!h&&!f||n.matches("mfa-totp-code",!0),v=!h||h&&c||n.matches("mfa-remember-device",!0),y=!c||n.matches("mfa-secret-code",!0),_=h||n.matches("new-password",!0),w=s.some((e=>e.endsWith("_error"))),$=this.in("busy");return t(b||(b=g` <main aria-live="polite" aria-busy="${0}" class="relative font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="busy" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </main> `),$,n.matches("email",!0)?"":this.__renderEmail(),h||n.matches("password",!0)?"":this.__renderPassword(),_||!p?"":this.__renderNewPassword(),m?"":this.__renderMfaTotpCode(),y?"":this.__renderMfaSecretCode(),v?"":this.__renderMfaRememberDevice(),n.matches("error",!0)||!w?"":this.__renderError(),n.matches("submit",!0)?"":this.__renderSubmit(),a({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!$}),d,u,null!==(o=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==o?o:"")}async _sendPost(e){const t=JSON.stringify(e),r=await this._fetch(this.parent,{body:t,method:"POST"}),o=i.Rumour(this.group),n=[...this.related,this.parent];return o.share({data:r,related:n,source:r._links.self.href}),r}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t="unknown_error";try{const r=(await e.json())._embedded["fx:errors"][0].code;"string"==typeof r&&(t=r)}catch(e){}throw[t]}}get __mfaSecretCode(){var e;const t=null===(e=this.form.credential)||void 0===e?void 0:e.mfa_secret_code;if(t)return t;const r="mfa_required",i=this.errors.find((e=>e.startsWith(r)));return null==i?void 0:i.replace(r,"").trim()}}customElements.define("foxy-sign-in-form",_);export{_ as SignInForm};
|
|
1
|
+
import"./shared-a8f38962.js";import"./shared-cc8ce493.js";import"./shared-4f33425a.js";import"./shared-b8ae5af7.js";import"./shared-433ff5ae.js";import"./shared-ff10b9fb.js";import"./shared-6b578d1a.js";import"./shared-a1f697c2.js";import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-0d4cdb19.js";import{_ as e}from"./shared-d1195c27.js";import{h as t}from"./shared-dc73b9a5.js";import{C as r}from"./shared-d1cb97c6.js";import{N as i}from"./shared-e8b8c8d0.js";import{T as o,a as n}from"./shared-70612035.js";import{c as a}from"./shared-4e709717.js";import{i as s}from"./shared-9803aa7c.js";import{v as l}from"./shared-b738ee96.js";import"./shared-6583e3f9.js";import"./shared-3db18172.js";import"./shared-25b83adb.js";import"./shared-8d826ccb.js";import"./shared-61ade33e.js";import"./shared-08e73812.js";import"./shared-52c9fa57.js";import"./shared-17a61265.js";import"./shared-343d1fd7.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";!function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var i,o;void 0===(o="function"==typeof(i=function(){for(var e=[null,[[10,7,17,13],[1,1,1,1],[]],[[16,10,28,22],[1,1,1,1],[4,16]],[[26,15,22,18],[1,1,2,2],[4,20]],[[18,20,16,26],[2,1,4,2],[4,24]],[[24,26,22,18],[2,1,4,4],[4,28]],[[16,18,28,24],[4,2,4,4],[4,32]],[[18,20,26,18],[4,2,5,6],[4,20,36]],[[22,24,26,22],[4,2,6,6],[4,22,40]],[[22,30,24,20],[5,2,8,8],[4,24,44]],[[26,18,28,24],[5,4,8,8],[4,26,48]],[[30,20,24,28],[5,4,11,8],[4,28,52]],[[22,24,28,26],[8,4,11,10],[4,30,56]],[[22,26,22,24],[9,4,16,12],[4,32,60]],[[24,30,24,20],[9,4,16,16],[4,24,44,64]],[[24,22,24,30],[10,6,18,12],[4,24,46,68]],[[28,24,30,24],[10,6,16,17],[4,24,48,72]],[[28,28,28,28],[11,6,19,16],[4,28,52,76]],[[26,30,28,28],[13,6,21,18],[4,28,54,80]],[[26,28,26,26],[14,7,25,21],[4,28,56,84]],[[26,28,28,30],[16,8,25,20],[4,32,60,88]],[[26,28,30,28],[17,8,25,23],[4,26,48,70,92]],[[28,28,24,30],[17,9,34,23],[4,24,48,72,96]],[[28,30,30,30],[18,9,30,25],[4,28,52,76,100]],[[28,30,30,30],[20,10,32,27],[4,26,52,78,104]],[[28,26,30,30],[21,12,35,29],[4,30,56,82,108]],[[28,28,30,28],[23,12,37,34],[4,28,56,84,112]],[[28,30,30,30],[25,12,40,34],[4,32,60,88,116]],[[28,30,30,30],[26,13,42,35],[4,24,48,72,96,120]],[[28,30,30,30],[28,14,45,38],[4,28,52,76,100,124]],[[28,30,30,30],[29,15,48,40],[4,24,50,76,102,128]],[[28,30,30,30],[31,16,51,43],[4,28,54,80,106,132]],[[28,30,30,30],[33,17,54,45],[4,32,58,84,110,136]],[[28,30,30,30],[35,18,57,48],[4,28,56,84,112,140]],[[28,30,30,30],[37,19,60,51],[4,32,60,88,116,144]],[[28,30,30,30],[38,19,63,53],[4,28,52,76,100,124,148]],[[28,30,30,30],[40,20,66,56],[4,22,48,74,100,126,152]],[[28,30,30,30],[43,21,70,59],[4,26,52,78,104,130,156]],[[28,30,30,30],[45,22,74,62],[4,30,56,82,108,134,160]],[[28,30,30,30],[47,24,77,65],[4,24,52,80,108,136,164]],[[28,30,30,30],[49,25,81,68],[4,28,56,84,112,140,168]]],t=/^\d*$/,r=/^[A-Za-z0-9 $%*+\-./:]*$/,i=/^[A-Z0-9 $%*+\-./:]*$/,o=[],n=[-1],a=0,s=1;a<255;++a)o.push(s),n[s]=a,s=2*s^(s>=128?285:0);var l=[[]];for(a=0;a<30;++a){for(var d=l[a],u=[],c=0;c<=a;++c){var f=c<a?o[d[c]]:0,h=o[(a+(d[c-1]||0))%255];u.push(n[f^h])}l.push(u)}var p={};for(a=0;a<45;++a)p["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".charAt(a)]=a;var m=[function(e,t){return(e+t)%2==0},function(e,t){return e%2==0},function(e,t){return t%3==0},function(e,t){return(e+t)%3==0},function(e,t){return((e/2|0)+(t/3|0))%2==0},function(e,t){return e*t%2+e*t%3==0},function(e,t){return(e*t%2+e*t%3)%2==0},function(e,t){return((e+t)%2+e*t%3)%2==0}],v=function(e){return e>6},b=function(t,r){var i=-8&function(t){var r=e[t],i=16*t*t+128*t+64;return v(t)&&(i-=36),r[2].length&&(i-=25*r[2].length*r[2].length-10*r[2].length-55),i}(t),o=e[t];return i-8*o[0][r]*o[1][r]},g=function(e,t){switch(t){case 1:return e<10?10:e<27?12:14;case 2:return e<10?9:e<27?11:13;case 4:return e<10?8:16;case 8:return e<10?8:e<27?10:12}},y=function(e,t,r){var i=b(e,r)-4-g(e,t);switch(t){case 1:return 3*(i/10|0)+(i%10<4?0:i%10<7?1:2);case 2:return 2*(i/11|0)+(i%11<6?0:1);case 4:return i/8|0;case 8:return i/13|0}},_=function(e,t){for(var r=e.slice(0),i=e.length,a=t.length,s=0;s<a;++s)r.push(0);for(s=0;s<i;){var l=n[r[s++]];if(l>=0)for(var d=0;d<a;++d)r[s+d]^=o[(l+t[d])%255]}return r.slice(i)},w=function(e,t,r,i){for(var o=e<<i,n=t-1;n>=0;--n)o>>i+n&1&&(o^=r<<n);return e<<i|o},$=function(e,t,r){for(var i=m[r],o=e.length,n=0;n<o;++n)for(var a=0;a<o;++a)t[n][a]||(e[n][a]^=i(n,a));return e},S=function(e,t,r,i){for(var o=e.length,n=21522^w(r<<3|i,5,1335,10),a=0;a<15;++a){var s=[o-1,o-2,o-3,o-4,o-5,o-6,o-7,o-8,7,5,4,3,2,1,0][a];e[[0,1,2,3,4,5,7,8,o-7,o-6,o-5,o-4,o-3,o-2,o-1][a]][8]=e[8][s]=n>>a&1}return e},x=function(e){for(var t=function(e){for(var t=0,r=0;r<e.length;++r)e[r]>=5&&(t+=e[r]-5+3);for(r=5;r<e.length;r+=2){var i=e[r];e[r-1]==i&&e[r-2]==3*i&&e[r-3]==i&&e[r-4]==i&&(e[r-5]>=4*i||e[r+1]>=4*i)&&(t+=40)}return t},r=e.length,i=0,o=0,n=0;n<r;++n){var a,s=e[n];a=[0];for(var l=0;l<r;){for(d=0;l<r&&s[l];++d)++l;for(a.push(d),d=0;l<r&&!s[l];++d)++l;a.push(d)}for(i+=t(a),a=[0],l=0;l<r;){var d;for(d=0;l<r&&e[l][n];++d)++l;for(a.push(d),d=0;l<r&&!e[l][n];++d)++l;a.push(d)}i+=t(a);var u=e[n+1]||[];for(o+=s[0],l=1;l<r;++l){var c=s[l];o+=c,s[l-1]==c&&u[l]===c&&u[l-1]===c&&(i+=3)}}return i+10*(Math.abs(o/r/r-.5)/.05|0)},j=function(t,r,i,o,n){var a=e[r],s=function(e,t,r,i){var o=[],n=0,a=8,s=r.length,l=function(e,t){if(t>=a){for(o.push(n|e>>(t-=a));t>=8;)o.push(e>>(t-=8)&255);n=0,a=8}t>0&&(n|=(e&(1<<t)-1)<<(a-=t))},d=g(e,t);switch(l(t,4),l(s,d),t){case 1:for(var u=2;u<s;u+=3)l(parseInt(r.substring(u-2,u+1),10),10);l(parseInt(r.substring(u-2),10),[0,4,7][s%3]);break;case 2:for(u=1;u<s;u+=2)l(45*p[r.charAt(u-1)]+p[r.charAt(u)],11);s%2==1&&l(p[r.charAt(u-1)],6);break;case 4:for(u=0;u<s;++u)l(r[u],8)}for(l(0,4),a<8&&o.push(n);o.length+1<i;)o.push(236,17);return o.length<i&&o.push(236),o}(r,i,t,b(r,o)>>3);s=function(e,t,r){for(var i=[],o=e.length/t|0,n=0,a=t-e.length%t,s=0;s<a;++s)i.push(n),n+=o;for(s=a;s<t;++s)i.push(n),n+=o+1;i.push(n);var l=[];for(s=0;s<t;++s)l.push(_(e.slice(i[s],i[s+1]),r));var d=[],u=e.length/t|0;for(s=0;s<u;++s)for(var c=0;c<t;++c)d.push(e[i[c]+s]);for(c=a;c<t;++c)d.push(e[i[c+1]-1]);for(s=0;s<r.length;++s)for(c=0;c<t;++c)d.push(l[c][s]);return d}(s,a[1][o],l[a[0][o]]);var d=function(t){for(var r=e[t],i=function(e){return 4*e+17}(t),o=[],n=[],a=0;a<i;++a)o.push([]),n.push([]);var s=function(e,t,r,i,a){for(var s=0;s<r;++s)for(var l=0;l<i;++l)o[e+s][t+l]=a[s]>>l&1,n[e+s][t+l]=1};for(s(0,0,9,9,[127,65,93,93,93,65,383,0,64]),s(i-8,0,8,9,[256,127,65,93,93,93,65,127]),s(0,i-8,9,8,[254,130,186,186,186,130,254,0,0]),a=9;a<i-8;++a)o[6][a]=o[a][6]=1&~a,n[6][a]=n[a][6]=1;var l=r[2],d=l.length;for(a=0;a<d;++a)for(var u=0==a?d-1:d,c=0==a||a==d-1?1:0;c<u;++c)s(l[a],l[c],5,5,[31,17,21,17,31]);if(v(t)){var f=w(t,6,7973,12),h=0;for(a=0;a<6;++a)for(c=0;c<3;++c)o[a][i-11+c]=o[i-11+c][a]=f>>h++&1,n[a][i-11+c]=n[i-11+c][a]=1}return{matrix:o,reserved:n}}(r),u=d.matrix,c=d.reserved;if(function(e,t,r){for(var i=e.length,o=0,n=-1,a=i-1;a>=0;a-=2){6==a&&--a;for(var s=n<0?i-1:0,l=0;l<i;++l){for(var d=a;d>a-2;--d)t[s][d]||(e[s][d]=r[o>>3]>>(7&~o)&1,++o);s+=n}n=-n}}(u,c,s),n<0){$(u,c,0),S(u,0,o,0);var f=0,h=x(u);for($(u,c,0),n=1;n<8;++n){$(u,c,n),S(u,0,o,n);var m=x(u);h>m&&(h=m,f=n),$(u,c,n)}n=f}return $(u,c,n),S(u,0,o,n),u},k={generate:function(e,o){var n=(o=o||{}).version||-1,a={L:1,M:0,Q:3,H:2}[(o.ecclevel||"L").toUpperCase()],s=o.mode?{numeric:1,alphanumeric:2,octet:4}[o.mode.toLowerCase()]:-1,l="mask"in o?o.mask:-1;if(s<0)s="string"==typeof e?e.match(t)?1:e.match(i)?2:4:4;else if(1!=s&&2!=s&&4!=s)throw"invalid or unsupported mode";if(null===(e=function(e,i){switch(e){case 1:return i.match(t)?i:null;case 2:return i.match(r)?i.toUpperCase():null;case 4:if("string"==typeof i){for(var o=[],n=0;n<i.length;++n){var a=i.charCodeAt(n);a<128?o.push(a):a<2048?o.push(192|a>>6,128|63&a):a<65536?o.push(224|a>>12,128|a>>6&63,128|63&a):o.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|63&a)}return o}return i}}(s,e)))throw"invalid data format";if(a<0||a>3)throw"invalid ECC level";if(n<0){for(n=1;n<=40&&!(e.length<=y(n,s,a));++n);if(n>40)throw"too large data"}else if(n<1||n>40)throw"invalid version";if(-1!=l&&(l<0||l>8))throw"invalid mask";return j(e,n,s,a,l)},generateHTML:function(e,t){t=t||{};for(var r=k.generate(e,t),i=Math.max(t.modulesize||5,.5),o=t.unit||"px",n=t.ratio||1,a=Math.max(null!==t.margin?t.margin:4,0),s=document.createElement("div"),l=r.length,d=['<table border="0" cellspacing="0" cellpadding="0" style="border:'+i*a+'px solid #fff;background:#fff">'],u=0;u<l;++u){d.push("<tr>");for(var c=0;c<l;++c){const e="px"!==o?"width:"+i*n+o+"; height:"+i*n+o:"width:"+i+"px;height:"+i+"px";console.log("generateHTML",{unit:o,ratio:n,modsize:i,size:e}),d.push('<td style="'+e+(r[u][c]?";background:#000":"")+'" part="'+(r[u][c]?"module-fg":"module-bg")+'" ></td>')}d.push("</tr>")}return s.className="qrcode",s.innerHTML=d.join("")+"</table>",s},generateSVG:function(e,t){t=t||{};var r=k.generate(e,t),i=r.length,o=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=o*(i+2*n),s=' class= "fg" width="'+o+'" height="'+o+'"/>',l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 "+a+" "+a),l.setAttribute("style","shape-rendering:crispEdges"),t.modulesize&&(l.setAttribute("width",a),l.setAttribute("height",a));for(var d=["<style scoped>.bg{fill:#FFF}.fg{fill:#000}</style>",'<rect class="bg" x="0" y="0"','width="'+a+'" height="'+a+'"/>'],u=n*o,c=0;c<i;++c){for(var f=n*o,h=0;h<i;++h)r[c][h]&&d.push('<rect x="'+f+'" y="'+u+'"',s),f+=o;u+=o}return l.innerHTML=d.join(""),l},generatePNG:function(e,t){t=t||{};var r,i=k.generate(e,t),o=Math.max(t.modulesize||5,.5),n=Math.max(null!==t.margin?t.margin:4,0),a=i.length,s=o*(a+2*n),l=document.createElement("canvas");if(l.width=l.height=s,!(r=l.getContext("2d")))throw"canvas support is needed for PNG output";r.fillStyle="#fff",r.fillRect(0,0,s,s),r.fillStyle="#000";for(var d=0;d<a;++d)for(var u=0;u<a;++u)i[d][u]&&r.fillRect(o*(n+u),o*(n+d),o,o);return l.toDataURL()}};return k})?i.apply(t,[]):i)||(e.exports=o)},function(e,t,r){r.r(t);var i=r(0),o=r.n(i);function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!==n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===n(o)?o:String(o)),i)}var o}function s(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return u(e,arguments,h(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),f(i,e)})(e)}function u(e,t,r){return(u=c()?Reflect.construct.bind():function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&f(o,r.prototype),o}).apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(p,e);var t,r,i,n,d,u=(t=p,r=c(),function(){var e,i=h(t);if(r){var o=h(this).constructor;e=Reflect.construct(i,arguments,o)}else e=i.apply(this,arguments);return s(this,e)});function p(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(e=u.call(this))._defineProperty=e._defineProperty.bind(l(e)),e.attachShadow({mode:"open"}),Object.keys(p.defaultAttributes).map(e._defineProperty),e}return i=p,d=[{key:"defaultAttributes",get:function(){return{data:null,format:"png",modulesize:5,margin:4,unit:"px",ratio:1}}},{key:"observedAttributes",get:function(){return Object.keys(p.defaultAttributes)}}],(n=[{key:"attributeChangedCallback",value:function(e,t,r){var i=this[e+"Changed"];i&&"function"==typeof i&&i.call(this,t,r),this.generate()}},{key:"_defineProperty",value:function(e){var t=this;Object.defineProperty(this,e,{get:function(){var r=t.getAttribute(e);return null===r?p.defaultAttributes[e]:r},set:function(r){t.setAttribute(e,r)}})}},{key:"getOptions",value:function(){var e=this.modulesize,t=this.margin,r=this.unit,i=this.ratio;return{margin:null!==t?parseInt(t):t,modulesize:null!==e?parseInt(e):e,unit:r||"px",ratio:i||1}}},{key:"generate",value:function(){try{this.clear(),null!==this.data?"png"===this.format?this.generatePNG():"html"===this.format?this.generateHTML():"svg"===this.format?this.generateSVG():this.shadowRoot.textContent="qr-code: ".concat(this.format," not supported!"):this.shadowRoot.textContent="qr-code: no data!"}catch(e){console.error(e),this.shadowRoot.textContent="qr-code: error!"}}},{key:"generatePNG",value:function(){var e=document.createElement("img");e.src=o.a.generatePNG(this.data,this.getOptions()),e.setAttribute("part","img"),this.shadowRoot.appendChild(e)}},{key:"generateHTML",value:function(){var e=o.a.generateHTML(this.data,this.getOptions()).firstChild;e.setAttribute("part","table"),this.shadowRoot.appendChild(e)}},{key:"generateSVG",value:function(){var e=o.a.generateSVG(this.data,this.getOptions());e.setAttribute("part","svg"),this.shadowRoot.appendChild(e)}},{key:"clear",value:function(){for(;this.shadowRoot.lastChild;)this.shadowRoot.removeChild(this.shadowRoot.lastChild)}}])&&a(i.prototype,n),d&&a(i,d),Object.defineProperty(i,"prototype",{writable:!1}),p}(d(HTMLElement));customElements.get("qr-code")||customElements.define("qr-code",p)}]);let d,u,c,f,h,p,m,v,b,g=e=>e;const y=o(r(n(i,"sign-in-form")));class _ extends y{constructor(){super(...arguments),this.issuer="Unknown",this.__autofillPoller=null,this.__emailValidator=()=>!this.errors.some((e=>e.startsWith("email"))),this.__passwordValidator=()=>!this.errors.some((e=>e.startsWith("password"))),this.__newPasswordValidator=()=>!this.errors.some((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),this.__mfaTotpCodeValidator=()=>!this.errors.some((e=>e.startsWith("mfa_totp_code")&&!e.endsWith("_error"))),this.__renderEmail=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("email"))),a=null==n?void 0:n.replace("email","v8n"),l=a?this.t(a).toString():"",u=this.in("busy");return t(d||(d=g` <div> ${0} <vaadin-email-field error-message="${0}" data-testid="email" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-email-field> ${0} </div> `),this.renderTemplateOrSlot("email:before"),l,this.t("email").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.email),u||r.matches("email",!0),i.matches("email",!0),this.__emailValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=e.target.value,o=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.password)&&void 0!==r?r:"";this.edit({credential:{email:i,password:o},type:"password"})}),this.renderTemplateOrSlot("email:after"))},this.__renderPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("password"))),a=null==n?void 0:n.replace("password","v8n"),l=a?this.t(a).toString():"",d=this.in("busy");return t(u||(u=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("password:before"),l,this.t("password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.password),d||r.matches("password",!0),i.matches("password",!0),this.__passwordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r;const i=null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",o=e.target.value;this.edit({credential:{email:i,password:o},type:"password"})}),this.renderTemplateOrSlot("password:after"))},this.__renderNewPassword=()=>{var e;const{disabledSelector:r,readonlySelector:i,errors:o}=this,n=o.find((e=>e.startsWith("new_password")&&!e.endsWith("_error"))),a=null==n?void 0:n.replace("new_password","v8n"),l=a?this.t(a).toString():"",d=this.in("busy");return t(c||(c=g` <div> ${0} <vaadin-password-field error-message="${0}" data-testid="new-password" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> ${0} </div> `),this.renderTemplateOrSlot("new-password:before"),l,this.t("new_password").toString(),s(null===(e=this.form.credential)||void 0===e?void 0:e.new_password),d||r.matches("new-password",!0),i.matches("new-password",!0),this.__newPasswordValidator,(e=>"Enter"===e.key&&this.submit()),(e=>{var t,r,i,o;this.edit({type:"password",credential:{email:null!==(r=null===(t=this.form.credential)||void 0===t?void 0:t.email)&&void 0!==r?r:"",password:null!==(o=null===(i=this.form.credential)||void 0===i?void 0:i.password)&&void 0!==o?o:"",new_password:e.target.value}})}),this.renderTemplateOrSlot("new-password:after"))},this.__renderMfaTotpCode=()=>{var r;const{disabledSelector:i,readonlySelector:o,errors:n}=this,a=this.__mfaSecretCode,l="mfa_totp_code",d="mfa-totp-code",u=n.find((e=>e.startsWith(l)&&!e.endsWith("_error"))),c=null==u?void 0:u.replace(l,"v8n"),h=c?this.t(c).toString():"",p=this.in("busy");return t(f||(f=g` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="123456" data-testid="${0}" class="w-full mb-m" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" autofocus @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${d}:before`),h,a?this.t("mfa_totp_code_hint"):"",d,this.t(l).toString(),s(null===(r=this.form.credential)||void 0===r?void 0:r.mfa_totp_code),p||i.matches(d,!0),o.matches(d,!0),this.__mfaTotpCodeValidator,(e=>"Enter"===e.key&&this.submit()),(t=>{const r=t.target.value,i=e(e({},this.form.credential),{},{mfa_totp_code:r});a&&(i.mfa_secret_code=a),this.edit({type:"password",credential:i})}),this.renderTemplateOrSlot(`${d}:after`))},this.__renderMfaSecretCode=()=>{var e,r;const i="mfa-secret-code",o=this.__mfaSecretCode,n=encodeURIComponent(this.issuer),a=encodeURIComponent(null!==(r=null===(e=this.form.credential)||void 0===e?void 0:e.email)&&void 0!==r?r:""),s=new URL(`otpauth://totp/${n}:${a}`);return s.searchParams.set("secret",o),s.searchParams.set("issuer",this.issuer),t(h||(h=g` <div> ${0} <div data-testid="${0}" class="flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10" style="background:#fff;color:#000"> <qr-code modulesize="2" margin="0" format="svg" class="inline-flex" data="${0}"> </qr-code> <div class="break-all font-medium leading-s text-xs tracking-widest"> ${0} </div> </div> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),i,s.toString(),o,this.renderTemplateOrSlot(`${i}:after`))},this.__renderMfaRememberDevice=()=>{var r;const{__mfaSecretCode:i,form:o,lang:n,ns:a}=this,s="mfa-remember-device",l=this.in("busy")||this.disabledSelector.matches(s,!0);return t(p||(p=g` <div> ${0} <vaadin-checkbox data-testid="${0}" class="mb-m" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block" lang="${0}" key="mfa_remember_device" ns="${0}"></foxy-i18n> <foxy-i18n class="block text-xs ${0}" lang="${0}" key="mfa_remember_device_hint" ns="${0}"> </foxy-i18n> </vaadin-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),s,l,!!(null===(r=o.credential)||void 0===r?void 0:r.mfa_remember_device),(t=>{var r,n;const a=t.currentTarget,s=e(e({},o.credential),{},{mfa_remember_device:a.checked,mfa_totp_code:null!==(n=null===(r=o.credential)||void 0===r?void 0:r.mfa_totp_code)&&void 0!==n?n:""});i&&(s.mfa_secret_code=i),this.edit({credential:s})}),n,a,l?"text-disabled":"text-secondary",n,a,this.renderTemplateOrSlot(`${s}:after`))},this.__renderError=()=>t(m||(m=g` <div> ${0} <p class="leading-s flex items-start text-s rounded p-s bg-error-10 text-error"> <iron-icon class="flex-shrink-0 mr-s icon-inline text-l" icon="lumo:error"></iron-icon> <foxy-i18n data-testid="error" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </p> ${0} </div> `),this.renderTemplateOrSlot("error:before"),this.lang,this.errors[0],this.ns,this.renderTemplateOrSlot("error:after")),this.__renderSubmit=()=>{const e=this.in({idle:{snapshot:{dirty:"valid"}}})||this.in({idle:{snapshot:{clean:"valid"}}})||this.in({idle:{template:{dirty:"valid"}}})||this.in({idle:{template:{clean:"valid"}}});return t(v||(v=g` <div> ${0} <vaadin-button data-testid="submit" class="w-full mt-m" theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="sign_in"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("submit:before"),!e||this.in("busy")||this.disabledSelector.matches("submit",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("submit:after"))}}static get properties(){return e(e({},super.properties),{},{issuer:{type:String}})}static get v8n(){return[({credential:e})=>!!(null==e?void 0:e.email)||"email_required",({credential:e})=>{var t;return l(null!==(t=null==e?void 0:e.email)&&void 0!==t?t:"")||"email_invalid_email"},({credential:e})=>!!(null==e?void 0:e.password)||"password_required",({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.new_password)||void 0===t?void 0:t.length)||"new_password_required"},({credential:e})=>{var t;return 0!==(null===(t=null==e?void 0:e.mfa_totp_code)||void 0===t?void 0:t.length)||"mfa_totp_code_required"}]}render(){var e,r,i,o;const{hiddenSelector:n,errors:s,lang:l,form:d,ns:u}=this,c=this.__mfaSecretCode,f=null===(e=d.credential)||void 0===e?void 0:e.mfa_totp_code,h=!!c||!!f||s.some((e=>e.startsWith("mfa"))),p="string"==typeof(null===(r=this.form.credential)||void 0===r?void 0:r.new_password)||s.some((e=>e.startsWith("new_password_"))),m=!h&&!f||n.matches("mfa-totp-code",!0),v=!h||h&&c||n.matches("mfa-remember-device",!0),y=!c||n.matches("mfa-secret-code",!0),_=h||n.matches("new-password",!0),w=s.some((e=>e.endsWith("_error"))),$=this.in("busy");return t(b||(b=g` <main aria-live="polite" aria-busy="${0}" class="relative font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="busy" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </main> `),$,n.matches("email",!0)?"":this.__renderEmail(),h||n.matches("password",!0)?"":this.__renderPassword(),_||!p?"":this.__renderNewPassword(),m?"":this.__renderMfaTotpCode(),y?"":this.__renderMfaSecretCode(),v?"":this.__renderMfaRememberDevice(),n.matches("error",!0)||!w?"":this.__renderError(),n.matches("submit",!0)?"":this.__renderSubmit(),a({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!$}),l,u,null!==(o=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==o?o:"")}connectedCallback(){super.connectedCallback(),null!==this.__autofillPoller&&window.clearInterval(this.__autofillPoller),this.__autofillPoller=window.setInterval((()=>{this.renderRoot.querySelectorAll("vaadin-text-field, vaadin-email-field, vaadin-password-field").forEach((e=>{var t;const r=null!==(t=e.getAttribute("value"))&&void 0!==t?t:"";e.value!==r&&e.dispatchEvent(new InputEvent("input"))}))}),250)}disconnectedCallback(){super.disconnectedCallback(),null!==this.__autofillPoller&&window.clearInterval(this.__autofillPoller)}async _sendPost(e){const t=JSON.stringify(e),r=await this._fetch(this.parent,{body:t,method:"POST"}),o=i.Rumour(this.group),n=[...this.related,this.parent];return o.share({data:r,related:n,source:r._links.self.href}),r}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t="unknown_error";try{const r=(await e.json())._embedded["fx:errors"][0].code;"string"==typeof r&&(t=r)}catch(e){}throw[t]}}get __mfaSecretCode(){var e;const t=null===(e=this.form.credential)||void 0===e?void 0:e.mfa_secret_code;if(t)return t;const r="mfa_required",i=this.errors.find((e=>e.startsWith(r)));return null==i?void 0:i.replace(r,"").trim()}}customElements.define("foxy-sign-in-form",_);export{_ as SignInForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-0d4cdb19.js";import"./shared-9dd252c7.js";import"./shared-67d1de9a.js";import"./shared-8a65adfd.js";import{I as e}from"./shared-e8744e04.js";import"./shared-433ff5ae.js";import"./shared-46189aae.js";import{a as t}from"./shared-684174e7.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-dc73b9a5.js";import{N as n}from"./shared-e8b8c8d0.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-9803aa7c.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-70612035.js";import"./shared-ccc7a886.js";import"./shared-6b5e4fe4.js";import"./shared-52c9fa57.js";import"./shared-6b578d1a.js";import"./shared-6583e3f9.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-343d1fd7.js";import"./shared-17a61265.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-77135874.js";import"./shared-ff10b9fb.js";import"./shared-08e73812.js";import"./shared-61ade33e.js";import"./shared-3db18172.js";import"./shared-cb24170b.js";import"./shared-a0c6a159.js";import"./shared-705ce87a.js";import"./shared-66e2a4ee.js";import"./shared-a1f697c2.js";import"./shared-69cdc370.js";import"./shared-b8ae5af7.js";import"./shared-2aee2a22.js";import"./shared-641786b2.js";import"./shared-2bf89a21.js";import"./shared-1d0d814b.js";import"./shared-4f33425a.js";import"./shared-25b83adb.js";import"./shared-cc8ce493.js";import"./shared-8d826ccb.js";import"./shared-a2616e4b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-148214ee.js";import"./shared-f79438f8.js";import"./shared-83c8a2d2.js";import"./shared-2dd2ff95.js";import"./shared-95a591b3.js";import"./shared-f4e03cdc.js";import"./shared-651c44fa.js";import"./shared-56ee26d7.js";import"./shared-a9b8c3ab.js";import"./shared-1acbd965.js";import"./shared-b73aaedb.js";import"./foxy-form-dialog.js";import"./shared-99940888.js";import"./shared-47fe9f56.js";import"./shared-3ef5dcef.js";import"./shared-f6f4bed5.js";import"./shared-7edf38e9.js";import"./shared-136942c7.js";import"./shared-57373d84.js";import"./shared-8d5b9662.js";import"./shared-5cdec81e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends t{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,$,k=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends t{renderControl(){var e,t,o,i,s,n,a,d,l,c;return r(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r($||($=k` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}});let S,P,A,C,H,L,E,I,R,B,q=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends t{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(S||(S=q``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(P||(P=q` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(A||(A=q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(C||(C=q` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(H||(H=q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(L||(L=q` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(E||(E=q` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=q` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(R||(R=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(B||(B=q` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let G,T,U,Z=e=>e;const M=c(u(e,"transaction"));class O extends M{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new O.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{O.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(G||(G=Z` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_;let y,v,x;const b=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),i=new URL(null!==(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data._links["fx:webhooks"].href)&&void 0!==t?t:""),r=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),i.searchParams.set("event_resource","transaction"),r.searchParams.set("zoom","item_options"),y=o.toString(),v=i.toString(),x=r.toString()}catch(e){}return r(T||(T=Z` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(i=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==i?i:"")?r(U||(U=Z` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(s=this.data)||void 0===s?void 0:s.status):"",b.matches("items",!0)&&b.matches("summary",!0),d(x),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(a=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===a?void 0:a._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href},d(null===(c=this.data)||void 0===c?void 0:c._links["fx:billing_addresses"].href),d(null===(u=this.data)||void 0===u?void 0:u._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(f=this.data)||void 0===f?void 0:f._links["fx:custom_fields"].href),d(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),d(y),d(v),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(h=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===h?void 0:h.href),d(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",O);export{O as Transaction};
|
|
1
|
+
import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-0d4cdb19.js";import"./shared-9dd252c7.js";import"./shared-67d1de9a.js";import"./shared-8a65adfd.js";import{I as e}from"./shared-e8744e04.js";import"./shared-433ff5ae.js";import"./shared-46189aae.js";import{a as t}from"./shared-684174e7.js";import{_ as o,B as i}from"./shared-d1195c27.js";import{h as r,s}from"./shared-dc73b9a5.js";import{N as n}from"./shared-e8b8c8d0.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as a}from"./shared-bab2ea2c.js";import{i as d}from"./shared-9803aa7c.js";import{c as l}from"./shared-4e709717.js";import{R as c,a as u}from"./shared-70612035.js";import"./shared-ccc7a886.js";import"./shared-6b5e4fe4.js";import"./shared-52c9fa57.js";import"./shared-6b578d1a.js";import"./shared-6583e3f9.js";import"./shared-51c4a6dd.js";import"./shared-d1cb97c6.js";import"./shared-343d1fd7.js";import"./shared-17a61265.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-77135874.js";import"./shared-ff10b9fb.js";import"./shared-08e73812.js";import"./shared-61ade33e.js";import"./shared-3db18172.js";import"./shared-cb24170b.js";import"./shared-a0c6a159.js";import"./shared-705ce87a.js";import"./shared-66e2a4ee.js";import"./shared-a1f697c2.js";import"./shared-69cdc370.js";import"./shared-b8ae5af7.js";import"./shared-2aee2a22.js";import"./shared-641786b2.js";import"./shared-2bf89a21.js";import"./shared-1d0d814b.js";import"./shared-4f33425a.js";import"./shared-25b83adb.js";import"./shared-cc8ce493.js";import"./shared-8d826ccb.js";import"./shared-148214ee.js";import"./shared-f79438f8.js";import"./shared-83c8a2d2.js";import"./shared-2dd2ff95.js";import"./shared-95a591b3.js";import"./shared-f4e03cdc.js";import"./shared-651c44fa.js";import"./shared-56ee26d7.js";import"./shared-a9b8c3ab.js";import"./shared-a2616e4b.js";import"./shared-22ba9566.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-1acbd965.js";import"./shared-b73aaedb.js";import"./foxy-form-dialog.js";import"./shared-99940888.js";import"./shared-47fe9f56.js";import"./shared-3ef5dcef.js";import"./shared-f6f4bed5.js";import"./shared-7edf38e9.js";import"./shared-136942c7.js";import"./shared-57373d84.js";import"./shared-8d5b9662.js";import"./shared-5cdec81e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let f,p=e=>e;customElements.define("foxy-internal-transaction-post-action-control",class extends t{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return o(o({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const e=this.__state,t="fail"===e?"error":"idle"===e?this.theme:"";return r(f||(f=p` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(e=>!e.detail.cancelled&&this.__submit()),t,"busy"===e||this.disabled,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),e)}async __submit(){var e;if("busy"!==this.__state)try{this.__state="busy";const t=new n.API(this),o=await t.fetch(null!==(e=this.href)&&void 0!==e?e:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(e){this.__state="fail"}}});let m,h,_,y,v=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends t{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return o(o({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,i;const n=this.nucleon,c=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=c?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,c):void 0;return r(m||(m=v` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),l({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(c),this.__renderCopyAction(s(h||(h=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(a(c)):""),this.__renderCopyAction(s(_||(_=v`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(i=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==i?i:""))}__renderCopyAction(e,t,o,i){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return r(y||(y=v` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(i,o)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),l({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,l({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let x,b,g,j,w,$,k=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends t{renderControl(){var e,t,o,i,s,n,a,d,l,c;return r(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"")}__renderSendEmailsAction(){var e,t;return r(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,o;return r(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return r(w||(w=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),d(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const i=this.nucleon,s=null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==i?void 0:i.getSubscriptionPageHref)||void 0===o?void 0:o.call(i,s):void 0;return r($||($=k` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}});let S,P,A,C,H,L,E,I,R,B,q=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends t{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,i,s,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(S||(S=q``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(i=u._embedded)||void 0===i?void 0:i["fx:shipments"])&&void 0!==s?s:[];return r(P||(P=q` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(A||(A=q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(C||(C=q` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(H||(H=q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(L||(L=q` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:applied_gift_card_codes"])||void 0===a?void 0:a.map((e=>{var t;return r(E||(E=q` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((e=>r(I||(I=q` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,i,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===s?void 0:s.currency_code;return r(R||(R=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let i="";return i=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(B||(B=q` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),i,o)}});let G,T,U,Z=e=>e;const M=c(u(e,"transaction"));class O extends M{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const o=e.data._links["fx:send_webhooks"].href,i=new O.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>a(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{O.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return o(o({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,o;const r=["billing-addresses","datafeed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])||r.push("items","attributes","custom-fields"),new i(r.join(" ").trim())}get hiddenSelector(){var e,t,o,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new i(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,o,i,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(o=this.data)||void 0===o?void 0:o._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){return r(G||(G=Z` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,o,i,s,n,a,l,c,u,f,p,m,h,_;let y,v,x;const b=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),i=new URL(null!==(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data._links["fx:webhooks"].href)&&void 0!==t?t:""),r=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),i.searchParams.set("event_resource","transaction"),r.searchParams.set("zoom","item_options"),y=o.toString(),v=i.toString(),x=r.toString()}catch(e){}return r(T||(T=Z` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-transaction-post-action-control infer="process-webhook" href="${0}"> </foxy-internal-transaction-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(i=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==i?i:"")?r(U||(U=Z` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(s=this.data)||void 0===s?void 0:s.status):"",b.matches("items",!0)&&b.matches("summary",!0),d(x),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(a=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===a?void 0:a._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href},d(null===(c=this.data)||void 0===c?void 0:c._links["fx:billing_addresses"].href),d(null===(u=this.data)||void 0===u?void 0:u._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(f=this.data)||void 0===f?void 0:f._links["fx:custom_fields"].href),d(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),d(y),d(v),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(h=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===h?void 0:h.href),d(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",O);export{O as Transaction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-9dd252c7.js";import"./shared-1d0d814b.js";import"./shared-67d1de9a.js";import"./shared-148214ee.js";import"./shared-cb24170b.js";import"./shared-a2616e4b.js";import{I as e}from"./shared-e8744e04.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{_ as r,B as t}from"./shared-d1195c27.js";import{g as s}from"./shared-bab2ea2c.js";import{a as o}from"./shared-70612035.js";import{i as a}from"./shared-9803aa7c.js";import{h as i}from"./shared-dc73b9a5.js";import"./shared-ff10b9fb.js";import"./shared-6583e3f9.js";import"./shared-6b578d1a.js";import"./shared-08e73812.js";import"./shared-b8ae5af7.js";import"./shared-61ade33e.js";import"./shared-83c8a2d2.js";import"./shared-2dd2ff95.js";import"./shared-95a591b3.js";import"./shared-433ff5ae.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-52c9fa57.js";import"./shared-0d4cdb19.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-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-46189aae.js";import"./shared-705ce87a.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-684174e7.js";import"./shared-51c4a6dd.js";import"./shared-4f33425a.js";import"./shared-25b83adb.js";import"./shared-cc8ce493.js";import"./shared-3db18172.js";import"./shared-8d826ccb.js";import"./shared-f79438f8.js";import"./shared-f4e03cdc.js";import"./shared-651c44fa.js";import"./shared-56ee26d7.js";import"./shared-a9b8c3ab.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-66e2a4ee.js";import"./shared-a1f697c2.js";import"./shared-ccc7a886.js";import"./shared-6b5e4fe4.js";let n,d=e=>e;class c extends(o(e,"webhook-form")){constructor(){super(...arguments),this.getStatusPageHref=null,this.getLogPageHref=null,this.resourceUri=null,this.__encryptionKeyGeneratorOptions={separator:"",length:512},this.__eventResources=[{value:"subscription",label:"event_resource_subscription"},{value:"transaction",label:"event_resource_transaction"},{value:"customer",label:"event_resource_customer"}]}static get properties(){return r(r({},super.properties),{},{getStatusPageHref:{attribute:!1},getLogPageHref:{attribute:!1},resourceUri:{attribute:"resource-uri"}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=255||"name:v8n_too_long",({url:e})=>!e||e.length<=1e3||"url:v8n_too_long",({query:e})=>!e||e.length<=1e3||"query:v8n_too_long",({encryption_key:e})=>!!e||"encryption-key:v8n_required",({encryption_key:e})=>!e||e.length<=1e3||"encryption-key:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data?e.unshift("general:event-resource"):e.unshift("logs","statuses"),new t(e.join(" ").trim())}get headerSubtitleOptions(){var e,r;const t=null===(e=this.data)||void 0===e?void 0:e.format;return{context:"json"===t?null===(r=this.data)||void 0===r?void 0:r.event_resource:t}}edit(e){super.edit(e),this.form.format||super.edit({format:"json"}),this.form.version||super.edit({version:2})}renderBody(){var e,r,t,o;const c=this.resourceUri?s(this.resourceUri):null;let l,m;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:statuses"].href)&&void 0!==r?r:"");null!==c&&t.searchParams.set("resource_id",String(c)),t.searchParams.set("order","date_created desc"),l=t.toString()}catch(e){l=void 0}try{const e=new URL(null!==(o=null===(t=this.data)||void 0===t?void 0:t._links["fx:logs"].href)&&void 0!==o?o:"");null!==c&&e.searchParams.set("resource_id",String(c)),e.searchParams.set("order","date_created desc"),m=e.toString()}catch(e){m=void 0}return i(n||(n=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="event-resource" .options="${0}"> </foxy-internal-select-control> <foxy-internal-password-control layout="summary-item" infer="encryption-key" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-source-control infer="query"></foxy-internal-source-control> <foxy-internal-source-control infer="url"></foxy-internal-source-control> <foxy-internal-async-list-control first="${0}" infer="statuses" limit="10" item="foxy-webhook-status-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" infer="logs" limit="10" item="foxy-webhook-log-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),this.__eventResources,this.__encryptionKeyGeneratorOptions,a(l),this.getStatusPageHref,this.resourceUri?{layout:"resource"}:{},a(m),this.getLogPageHref,this.resourceUri?{layout:"resource"}:{},super.renderBody())}}customElements.define("foxy-webhook-form",c);export{c as WebhookForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0d4cdb19.js";import"./shared-ccc7a886.js";import{
|
|
1
|
+
import"./shared-0d4cdb19.js";import"./shared-ccc7a886.js";import{_ as s}from"./shared-d1195c27.js";import{a as e}from"./shared-70612035.js";import{I as r}from"./shared-6b5e4fe4.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./foxy-spinner.js";import"./shared-6b578d1a.js";import"./shared-6583e3f9.js";import"./shared-52c9fa57.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";let o,a,d=s=>s;class i extends(e(r,"webhook-log-card")){constructor(){super(...arguments),this.layout=null}static get properties(){return s(s({},super.properties),{},{layout:{}})}renderBody(){var s;const{response_body:e,response_code:r,resource_type:i,date_created:p,resource_id:c}=null!==(s=this.data)&&void 0!==s?s:{};return t(o||(o=d` <div class="leading-none space-y-xs"> <p class="flex justify-between items-center"> <foxy-i18n .options="${0}" class="font-medium" infer="" key="date"> </foxy-i18n> ${0} </p> <p class="text-secondary text-s">HTTP ${0} • ${0}</p> </div> `),{value:p},"resource"===this.layout?"":t(a||(a=d`<span class="text-xs text-tertiary capitalize">${0} #${0}</span>`),i,c),r,e)}}customElements.define("foxy-webhook-log-card",i);export{i as WebhookLogCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0d4cdb19.js";import"./shared-ccc7a886.js";import{
|
|
1
|
+
import"./shared-0d4cdb19.js";import"./shared-ccc7a886.js";import{_ as s}from"./shared-d1195c27.js";import{a as e}from"./shared-70612035.js";import{I as r}from"./shared-6b5e4fe4.js";import{h as t}from"./shared-dc73b9a5.js";import{c as a}from"./shared-4e709717.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./foxy-spinner.js";import"./shared-6b578d1a.js";import"./shared-6583e3f9.js";import"./shared-52c9fa57.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";let o,d,i=s=>s;const c=e(r,"webhook-status-card");class p extends c{constructor(){super(...arguments),this.layout=null}static get properties(){return s(s({},super.properties),{},{layout:{}})}renderBody(){var s;const{resource_type:e,date_created:r,resource_id:c,status:p}=null!==(s=this.data)&&void 0!==s?s:{};return t(o||(o=i` <div class="leading-none space-y-xs"> <p class="flex justify-between items-center"> <foxy-i18n .options="${0}" class="font-medium" infer="" key="date"> </foxy-i18n> ${0} </p> <p class="${0}"> <foxy-i18n infer="" key="status_${0}"></foxy-i18n> </p> </div> `),{value:r},"resource"===this.layout?"":t(d||(d=i`<span class="text-xs text-tertiary capitalize">${0} #${0}</span>`),e,c),a({"text-secondary":"pending"===p,"text-success":"successful"===p,"text-error":"failed"===p,"text-s":!0}),p)}}customElements.define("foxy-webhook-status-card",p);export{p as WebhookStatusCard};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"cart_type_default": "Sidecart",
|
|
17
17
|
"cart_type_default_explainer": "Default cart appearance in version 2.0",
|
|
18
18
|
"cart_type_fullpage": "Full page",
|
|
19
|
-
"cart_type_fullpage_explainer": "Send all customers to a full page cart while still including
|
|
19
|
+
"cart_type_fullpage_explainer": "Send all customers to a full page cart while still including mini-cart functionality",
|
|
20
20
|
"checked_by_default": "Checked by default",
|
|
21
21
|
"checkout_type": "Accounts",
|
|
22
22
|
"checkout_type_account_only": "Allow customer accounts only",
|
|
@@ -21,39 +21,44 @@
|
|
|
21
21
|
"done": "Copied to clipboard"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"
|
|
25
|
-
"label": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
"general": {
|
|
25
|
+
"label": "",
|
|
26
|
+
"helper_text": "",
|
|
27
|
+
"name": {
|
|
28
|
+
"label": "Name",
|
|
29
|
+
"placeholder": "Required",
|
|
30
|
+
"helper_text": "",
|
|
31
|
+
"v8n_required": "Webhook name is required",
|
|
32
|
+
"v8n_too_long": "Webhook name cannot exceed 255 characters"
|
|
33
|
+
},
|
|
34
|
+
"encryption-key": {
|
|
35
|
+
"label": "Encryption key",
|
|
36
|
+
"placeholder": "Required",
|
|
37
|
+
"helper_text": "",
|
|
38
|
+
"v8n_required": "Encryption key is required. Use the ✨ button to generate a new key.",
|
|
39
|
+
"v8n_too_long": "Encryption key cannot exceed 1000 characters"
|
|
40
|
+
},
|
|
41
|
+
"event-resource": {
|
|
42
|
+
"label": "Resource",
|
|
43
|
+
"helper_text": "",
|
|
44
|
+
"placeholder": "Select...",
|
|
45
|
+
"event_resource_subscription": "Subscription",
|
|
46
|
+
"event_resource_transaction": "Transaction",
|
|
47
|
+
"event_resource_customer": "Customer"
|
|
48
|
+
}
|
|
30
49
|
},
|
|
31
50
|
"url": {
|
|
32
|
-
"label": "
|
|
33
|
-
"placeholder": "https://example.com/webhook",
|
|
34
|
-
"helper_text": "
|
|
51
|
+
"label": "Endpoint",
|
|
52
|
+
"placeholder": "Example: https://example.com/webhook",
|
|
53
|
+
"helper_text": "",
|
|
35
54
|
"v8n_too_long": "URL cannot exceed 1000 characters"
|
|
36
55
|
},
|
|
37
56
|
"query": {
|
|
38
57
|
"label": "Query",
|
|
39
|
-
"placeholder": "zoom=items,items:options,customer",
|
|
40
|
-
"helper_text": "
|
|
58
|
+
"placeholder": "Example: zoom=items,items:options,customer",
|
|
59
|
+
"helper_text": "",
|
|
41
60
|
"v8n_too_long": "Query cannot exceed 1000 characters"
|
|
42
61
|
},
|
|
43
|
-
"encryption-key": {
|
|
44
|
-
"label": "Encryption key",
|
|
45
|
-
"placeholder": "HNL978XVXXCM66DM5N2T78D5MT66BC6D",
|
|
46
|
-
"helper_text": "The JSON webhooks are encrypted in certain situations. This key is also used to generate a signature to verify the integrity of the payload.",
|
|
47
|
-
"v8n_required": "Encryption key is required. Use the ✨ button to generate a new key.",
|
|
48
|
-
"v8n_too_long": "Encryption key cannot exceed 1000 characters"
|
|
49
|
-
},
|
|
50
|
-
"event-resource": {
|
|
51
|
-
"label": "Resource",
|
|
52
|
-
"helper_text": "Changes in selected resource type will trigger this webhook. Resource type cannot be changed after the webhook has been created.",
|
|
53
|
-
"event_resource_subscription": "Subscription",
|
|
54
|
-
"event_resource_transaction": "Transaction",
|
|
55
|
-
"event_resource_customer": "Customer"
|
|
56
|
-
},
|
|
57
62
|
"statuses": {
|
|
58
63
|
"label": "Runs",
|
|
59
64
|
"pagination": {
|
|
@@ -17,6 +17,7 @@ export declare class SignInForm extends Base<Data> {
|
|
|
17
17
|
static get properties(): PropertyDeclarations;
|
|
18
18
|
static get v8n(): NucleonV8N<Data>;
|
|
19
19
|
issuer: string;
|
|
20
|
+
private __autofillPoller;
|
|
20
21
|
private readonly __emailValidator;
|
|
21
22
|
private readonly __passwordValidator;
|
|
22
23
|
private readonly __newPasswordValidator;
|
|
@@ -30,6 +31,8 @@ export declare class SignInForm extends Base<Data> {
|
|
|
30
31
|
private readonly __renderError;
|
|
31
32
|
private readonly __renderSubmit;
|
|
32
33
|
render(): TemplateResult;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
disconnectedCallback(): void;
|
|
33
36
|
protected _sendPost(edits: Partial<Data>): Promise<Data>;
|
|
34
37
|
protected _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult>;
|
|
35
38
|
private get __mfaSecretCode();
|
|
@@ -18,6 +18,7 @@ export class SignInForm extends Base {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.issuer = 'Unknown';
|
|
21
|
+
this.__autofillPoller = null;
|
|
21
22
|
this.__emailValidator = () => !this.errors.some(err => err.startsWith('email'));
|
|
22
23
|
this.__passwordValidator = () => !this.errors.some(err => err.startsWith('password'));
|
|
23
24
|
this.__newPasswordValidator = () => {
|
|
@@ -352,6 +353,27 @@ export class SignInForm extends Base {
|
|
|
352
353
|
</main>
|
|
353
354
|
`;
|
|
354
355
|
}
|
|
356
|
+
connectedCallback() {
|
|
357
|
+
super.connectedCallback();
|
|
358
|
+
if (this.__autofillPoller !== null)
|
|
359
|
+
window.clearInterval(this.__autofillPoller);
|
|
360
|
+
this.__autofillPoller = window.setInterval(() => {
|
|
361
|
+
const selector = 'vaadin-text-field, vaadin-email-field, vaadin-password-field';
|
|
362
|
+
const fields = this.renderRoot.querySelectorAll(selector);
|
|
363
|
+
fields.forEach(field => {
|
|
364
|
+
var _a;
|
|
365
|
+
const attrValue = (_a = field.getAttribute('value')) !== null && _a !== void 0 ? _a : '';
|
|
366
|
+
const propValue = field.value;
|
|
367
|
+
if (propValue !== attrValue)
|
|
368
|
+
field.dispatchEvent(new InputEvent('input'));
|
|
369
|
+
});
|
|
370
|
+
}, 250);
|
|
371
|
+
}
|
|
372
|
+
disconnectedCallback() {
|
|
373
|
+
super.disconnectedCallback();
|
|
374
|
+
if (this.__autofillPoller !== null)
|
|
375
|
+
window.clearInterval(this.__autofillPoller);
|
|
376
|
+
}
|
|
355
377
|
async _sendPost(edits) {
|
|
356
378
|
const body = JSON.stringify(edits);
|
|
357
379
|
const data = await this._fetch(this.parent, { body, method: 'POST' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAkBE,WAAM,GAAG,SAAS,CAAC;QAEF,qBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAE3E,wBAAmB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QAEjF,2BAAsB,GAAG,GAAG,EAAE;YAC7C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI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,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE/D,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,MAAM,CAAiB,GAAG,IAAiC;QACzE,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,QAAQ,GAAG,eAAe,CAAC;YAE/B,IAAI;gBACF,MAAM,IAAI,GAAG,CAAC,MAAO,GAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,QAAQ,GAAG,IAAI,CAAC;aAC/C;YAAC,WAAM;gBACN,kCAAkC;aACnC;YAED,MAAM,CAAC,QAAQ,CAAC,CAAC;SAClB;IACH,CAAC;IAED,IAAY,eAAe;;QACzB,MAAM,YAAY,SAAG,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,eAAe,CAAC;QAC3D,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC;QAEtC,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,OAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n issuer = 'Unknown';\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-medium leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n rumour.share({ data, related, source: data._links.self.href });\n\n return data;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAkBE,WAAM,GAAG,SAAS,CAAC;QAEX,qBAAgB,GAAkB,IAAI,CAAC;QAE9B,qBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,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,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE/D,OAAO,IAAI,CAAC;IACd,CAAC;IAES,KAAK,CAAC,MAAM,CAAiB,GAAG,IAAiC;QACzE,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,QAAQ,GAAG,eAAe,CAAC;YAE/B,IAAI;gBACF,MAAM,IAAI,GAAG,CAAC,MAAO,GAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,QAAQ,GAAG,IAAI,CAAC;aAC/C;YAAC,WAAM;gBACN,kCAAkC;aACnC;YAED,MAAM,CAAC,QAAQ,CAAC,CAAC;SAClB;IACH,CAAC;IAED,IAAY,eAAe;;QACzB,MAAM,YAAY,SAAG,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,eAAe,CAAC;QAC3D,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC;QAEtC,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,OAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n issuer = 'Unknown';\n\n private __autofillPoller: number | null = null;\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-medium leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n if (this.__autofillPoller !== null) window.clearInterval(this.__autofillPoller);\n\n this.__autofillPoller = window.setInterval(() => {\n type Field = EmailFieldElement | PasswordFieldElement | TextFieldElement;\n const selector = 'vaadin-text-field, vaadin-email-field, vaadin-password-field';\n const fields = this.renderRoot.querySelectorAll<Field>(selector);\n\n fields.forEach(field => {\n const attrValue = field.getAttribute('value') ?? '';\n const propValue = field.value;\n if (propValue !== attrValue) field.dispatchEvent(new InputEvent('input'));\n });\n }, 250);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.__autofillPoller !== null) window.clearInterval(this.__autofillPoller);\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n rumour.share({ data, related, source: data._links.self.href });\n\n return data;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PropertyDeclarations } from 'lit-element';
|
|
2
2
|
import type { TemplateResult } from 'lit-html';
|
|
3
3
|
import type { NucleonV8N } from '../NucleonElement/types';
|
|
4
|
-
import type { Data } from './types';
|
|
4
|
+
import type { Data, WebhookLog } from './types';
|
|
5
5
|
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
6
6
|
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
7
7
|
declare const WebhookForm_base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
@@ -16,6 +16,10 @@ declare const WebhookForm_base: typeof InternalForm & import("lit-element").Cons
|
|
|
16
16
|
export declare class WebhookForm extends WebhookForm_base<Data> {
|
|
17
17
|
static get properties(): PropertyDeclarations;
|
|
18
18
|
static get v8n(): NucleonV8N<Data>;
|
|
19
|
+
/** If set, renders Statuses list items as <a> tags. */
|
|
20
|
+
getStatusPageHref: ((statusHref: string, status: WebhookLog) => string | null) | null;
|
|
21
|
+
/** If set, renders Logs list items as <a> tags. */
|
|
22
|
+
getLogPageHref: ((logHref: string, log: WebhookLog) => string | null) | null;
|
|
19
23
|
/**
|
|
20
24
|
* Optional URI of a transaction, customer or subscription. When provided,
|
|
21
25
|
* the form will display logs and statuses for that particular resource only.
|
|
@@ -12,6 +12,10 @@ import { html } from 'lit-html';
|
|
|
12
12
|
export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form') {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
+
/** If set, renders Statuses list items as <a> tags. */
|
|
16
|
+
this.getStatusPageHref = null;
|
|
17
|
+
/** If set, renders Logs list items as <a> tags. */
|
|
18
|
+
this.getLogPageHref = null;
|
|
15
19
|
/**
|
|
16
20
|
* Optional URI of a transaction, customer or subscription. When provided,
|
|
17
21
|
* the form will display logs and statuses for that particular resource only.
|
|
@@ -27,6 +31,8 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
|
|
|
27
31
|
static get properties() {
|
|
28
32
|
return {
|
|
29
33
|
...super.properties,
|
|
34
|
+
getStatusPageHref: { attribute: false },
|
|
35
|
+
getLogPageHref: { attribute: false },
|
|
30
36
|
resourceUri: { attribute: 'resource-uri' },
|
|
31
37
|
};
|
|
32
38
|
}
|
|
@@ -42,8 +48,12 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
|
|
|
42
48
|
}
|
|
43
49
|
get hiddenSelector() {
|
|
44
50
|
const alwaysMatch = [super.hiddenSelector.toString()];
|
|
45
|
-
if (this.data)
|
|
46
|
-
alwaysMatch.unshift('event-resource');
|
|
51
|
+
if (this.data) {
|
|
52
|
+
alwaysMatch.unshift('general:event-resource');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
alwaysMatch.unshift('logs', 'statuses');
|
|
56
|
+
}
|
|
47
57
|
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
48
58
|
}
|
|
49
59
|
get headerSubtitleOptions() {
|
|
@@ -86,40 +96,50 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
|
|
|
86
96
|
return html `
|
|
87
97
|
${this.renderHeader()}
|
|
88
98
|
|
|
89
|
-
<foxy-internal-
|
|
99
|
+
<foxy-internal-summary-control infer="general">
|
|
100
|
+
<foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control>
|
|
90
101
|
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
<foxy-internal-select-control
|
|
103
|
+
layout="summary-item"
|
|
104
|
+
infer="event-resource"
|
|
105
|
+
.options=${this.__eventResources}
|
|
106
|
+
>
|
|
107
|
+
</foxy-internal-select-control>
|
|
93
108
|
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
<foxy-internal-password-control
|
|
110
|
+
layout="summary-item"
|
|
111
|
+
infer="encryption-key"
|
|
112
|
+
show-generator
|
|
113
|
+
.generatorOptions=${this.__encryptionKeyGeneratorOptions}
|
|
114
|
+
>
|
|
115
|
+
</foxy-internal-password-control>
|
|
116
|
+
</foxy-internal-summary-control>
|
|
96
117
|
|
|
97
|
-
<foxy-internal-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
<foxy-internal-source-control infer="query"></foxy-internal-source-control>
|
|
119
|
+
<foxy-internal-source-control infer="url"></foxy-internal-source-control>
|
|
120
|
+
|
|
121
|
+
<foxy-internal-async-list-control
|
|
122
|
+
first=${ifDefined(statusesLink)}
|
|
123
|
+
infer="statuses"
|
|
124
|
+
limit="10"
|
|
125
|
+
item="foxy-webhook-status-card"
|
|
126
|
+
hide-delete-button
|
|
127
|
+
.getPageHref=${this.getStatusPageHref}
|
|
128
|
+
.itemProps=${this.resourceUri ? { layout: 'resource' } : {}}
|
|
101
129
|
>
|
|
102
|
-
</foxy-internal-
|
|
130
|
+
</foxy-internal-async-list-control>
|
|
103
131
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
132
|
+
<foxy-internal-async-list-control
|
|
133
|
+
first=${ifDefined(logsLink)}
|
|
134
|
+
infer="logs"
|
|
135
|
+
limit="10"
|
|
136
|
+
item="foxy-webhook-log-card"
|
|
137
|
+
hide-delete-button
|
|
138
|
+
.getPageHref=${this.getLogPageHref}
|
|
139
|
+
.itemProps=${this.resourceUri ? { layout: 'resource' } : {}}
|
|
140
|
+
>
|
|
141
|
+
</foxy-internal-async-list-control>
|
|
113
142
|
|
|
114
|
-
<foxy-internal-async-list-control
|
|
115
|
-
first=${ifDefined(logsLink)}
|
|
116
|
-
infer="logs"
|
|
117
|
-
limit="10"
|
|
118
|
-
item="foxy-webhook-log-card"
|
|
119
|
-
>
|
|
120
|
-
</foxy-internal-async-list-control>
|
|
121
|
-
`
|
|
122
|
-
: ''}
|
|
123
143
|
${super.renderBody()}
|
|
124
144
|
`;
|
|
125
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookForm.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/WebhookForm.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC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;gBAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;YACjF,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;YACnD,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;SAC3B;QAAC,WAAM;YACN,QAAQ,GAAG,SAAS,CAAC;SACtB;QAED,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,YAAY,EAAE;;;;;;;;qBAQN,IAAI,CAAC,gBAAgB;;;;;;;;8BAQZ,IAAI,CAAC,+BAA+B;;;;;;;;;gBASlD,SAAS,CAAC,YAAY,CAAC;;;;;uBAKhB,IAAI,CAAC,iBAAiB;qBACxB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;;;;;gBAKnD,SAAS,CAAC,QAAQ,CAAC;;;;;uBAKZ,IAAI,CAAC,cAAc;qBACrB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;;;;QAI3D,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Data, WebhookLog } from './types';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing webhooks (`fx:webhook`).\n *\n * @element foxy-webhook-form\n * @since 1.17.0\n */\nexport class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getStatusPageHref: { attribute: false },\n getLogPageHref: { attribute: false },\n resourceUri: { attribute: 'resource-uri' },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (!!v && v.length <= 255) || 'name:v8n_too_long',\n ({ url: v }) => !v || v.length <= 1000 || 'url:v8n_too_long',\n ({ query: v }) => !v || v.length <= 1000 || 'query:v8n_too_long',\n ({ encryption_key: v }) => !!v || 'encryption-key:v8n_required',\n ({ encryption_key: v }) => !v || v.length <= 1000 || 'encryption-key:v8n_too_long',\n ];\n }\n\n /** If set, renders Statuses list items as <a> tags. */\n getStatusPageHref: ((statusHref: string, status: WebhookLog) => string | null) | null = null;\n\n /** If set, renders Logs list items as <a> tags. */\n getLogPageHref: ((logHref: string, log: WebhookLog) => string | null) | null = null;\n\n /**\n * Optional URI of a transaction, customer or subscription. When provided,\n * the form will display logs and statuses for that particular resource only.\n */\n resourceUri: string | null = null;\n\n private __encryptionKeyGeneratorOptions = { separator: '', length: 512 };\n\n private __eventResources = [\n { value: 'subscription', label: 'event_resource_subscription' },\n { value: 'transaction', label: 'event_resource_transaction' },\n { value: 'customer', label: 'event_resource_customer' },\n ];\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch: string[] = [super.hiddenSelector.toString()];\n\n if (this.data) {\n alwaysMatch.unshift('general:event-resource');\n } else {\n alwaysMatch.unshift('logs', 'statuses');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const format = this.data?.format;\n return { context: format === 'json' ? this.data?.event_resource : format };\n }\n\n edit(data: Partial<Data>): void {\n super.edit(data);\n if (!this.form.format) super.edit({ format: 'json' });\n if (!this.form.version) super.edit({ version: 2 });\n }\n\n renderBody(): TemplateResult {\n const resourceId = this.resourceUri ? getResourceId(this.resourceUri) : null;\n\n let statusesLink: string | undefined;\n let logsLink: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:statuses'].href ?? '');\n if (resourceId !== null) url.searchParams.set('resource_id', String(resourceId));\n url.searchParams.set('order', 'date_created desc');\n statusesLink = url.toString();\n } catch {\n statusesLink = undefined;\n }\n\n try {\n const url = new URL(this.data?._links['fx:logs'].href ?? '');\n if (resourceId !== null) url.searchParams.set('resource_id', String(resourceId));\n url.searchParams.set('order', 'date_created desc');\n logsLink = url.toString();\n } catch {\n logsLink = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"event-resource\"\n .options=${this.__eventResources}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-password-control\n layout=\"summary-item\"\n infer=\"encryption-key\"\n show-generator\n .generatorOptions=${this.__encryptionKeyGeneratorOptions}\n >\n </foxy-internal-password-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control infer=\"query\"></foxy-internal-source-control>\n <foxy-internal-source-control infer=\"url\"></foxy-internal-source-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(statusesLink)}\n infer=\"statuses\"\n limit=\"10\"\n item=\"foxy-webhook-status-card\"\n hide-delete-button\n .getPageHref=${this.getStatusPageHref}\n .itemProps=${this.resourceUri ? { layout: 'resource' } : {}}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(logsLink)}\n infer=\"logs\"\n limit=\"10\"\n item=\"foxy-webhook-log-card\"\n hide-delete-button\n .getPageHref=${this.getLogPageHref}\n .itemProps=${this.resourceUri ? { layout: 'resource' } : {}}\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import '../../internal/InternalRadioGroupControl/index';
|
|
2
1
|
import '../../internal/InternalAsyncListControl/index';
|
|
3
2
|
import '../../internal/InternalPasswordControl/index';
|
|
3
|
+
import '../../internal/InternalSummaryControl/index';
|
|
4
|
+
import '../../internal/InternalSelectControl/index';
|
|
5
|
+
import '../../internal/InternalSourceControl/index';
|
|
4
6
|
import '../../internal/InternalTextControl/index';
|
|
5
7
|
import '../../internal/InternalForm/index';
|
|
6
8
|
import '../WebhookStatusCard/index';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import "../../internal/InternalRadioGroupControl/index.js";
|
|
2
1
|
import "../../internal/InternalAsyncListControl/index.js";
|
|
3
2
|
import "../../internal/InternalPasswordControl/index.js";
|
|
3
|
+
import "../../internal/InternalSummaryControl/index.js";
|
|
4
|
+
import "../../internal/InternalSelectControl/index.js";
|
|
5
|
+
import "../../internal/InternalSourceControl/index.js";
|
|
4
6
|
import "../../internal/InternalTextControl/index.js";
|
|
5
7
|
import "../../internal/InternalForm/index.js";
|
|
6
8
|
import "../WebhookStatusCard/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/index.ts"],"names":[],"mappings":"AAAA,0DAAuD;AACvD,yDAAsD;AACtD,wDAAqD;AACrD,uDAAoD;AACpD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,uCAAoC;AACpC,oCAAiC;AAEjC,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAE5C,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalPasswordControl/index';\nimport '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalSelectControl/index';\nimport '../../internal/InternalSourceControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../WebhookStatusCard/index';\nimport '../WebhookLogCard/index';\n\nimport { WebhookForm } from './WebhookForm';\n\ncustomElements.define('foxy-webhook-form', WebhookForm);\n\nexport { WebhookForm };\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
2
2
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
3
3
|
export declare type Data = Resource<Rels.Webhook>;
|
|
4
|
+
export declare type WebhookLog = Resource<Rels.WebhookLog>;
|
|
5
|
+
export declare type WebhookStatus = Resource<Rels.WebhookStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels } from '@foxy.io/sdk/backend';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.Webhook>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels } from '@foxy.io/sdk/backend';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.Webhook>;\nexport type WebhookLog = Resource<Rels.WebhookLog>;\nexport type WebhookStatus = Resource<Rels.WebhookStatus>;\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropertyDeclarations } from 'lit-element';
|
|
1
2
|
import type { TemplateResult } from 'lit-html';
|
|
2
3
|
import type { Data } from './types';
|
|
3
4
|
import { InternalCard } from '../../internal/InternalCard/InternalCard';
|
|
@@ -11,6 +12,9 @@ declare const WebhookLogCard_base: typeof InternalCard & import("lit-element").C
|
|
|
11
12
|
* @since 1.17.0
|
|
12
13
|
*/
|
|
13
14
|
export declare class WebhookLogCard extends WebhookLogCard_base<Data> {
|
|
15
|
+
static get properties(): PropertyDeclarations;
|
|
16
|
+
/** When set to "resource", doesn't render resource type and ID. */
|
|
17
|
+
layout: null | 'resource';
|
|
14
18
|
renderBody(): TemplateResult;
|
|
15
19
|
}
|
|
16
20
|
export {};
|
|
@@ -8,18 +8,30 @@ import { html } from 'lit-html';
|
|
|
8
8
|
* @since 1.17.0
|
|
9
9
|
*/
|
|
10
10
|
export class WebhookLogCard extends TranslatableMixin(InternalCard, 'webhook-log-card') {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
/** When set to "resource", doesn't render resource type and ID. */
|
|
14
|
+
this.layout = null;
|
|
15
|
+
}
|
|
16
|
+
static get properties() {
|
|
17
|
+
return {
|
|
18
|
+
...super.properties,
|
|
19
|
+
layout: {},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
11
22
|
renderBody() {
|
|
12
23
|
var _a;
|
|
13
|
-
const {
|
|
24
|
+
const { response_body: body, response_code: code, resource_type: type, date_created: date, resource_id: id, } = (_a = this.data) !== null && _a !== void 0 ? _a : {};
|
|
14
25
|
return html `
|
|
15
26
|
<div class="leading-none space-y-xs">
|
|
16
27
|
<p class="flex justify-between items-center">
|
|
17
|
-
<foxy-i18n .options=${{ value:
|
|
28
|
+
<foxy-i18n .options=${{ value: date }} class="font-medium" infer="" key="date">
|
|
18
29
|
</foxy-i18n>
|
|
19
|
-
|
|
30
|
+
${this.layout === 'resource'
|
|
31
|
+
? ''
|
|
32
|
+
: html `<span class="text-xs text-tertiary capitalize">${type} #${id}</span>`}
|
|
20
33
|
</p>
|
|
21
|
-
|
|
22
|
-
<p class="text-secondary text-s">${response_body}​</p>
|
|
34
|
+
<p class="text-secondary text-s">HTTP ${code} • ${body}</p>
|
|
23
35
|
</div>
|
|
24
36
|
`;
|
|
25
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookLogCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookLogCard/WebhookLogCard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebhookLogCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookLogCard/WebhookLogCard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB,CAAC,YAAY,EAAE,kBAAkB,CAAO;IAA7F;;QAQE,mEAAmE;QACnE,WAAM,GAAsB,IAAI,CAAC;IAwBnC,CAAC;IAhCC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAKD,UAAU;;QACR,MAAM,EACJ,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,IAAI,EACnB,aAAa,EAAE,IAAI,EACnB,YAAY,EAAE,IAAI,EAClB,WAAW,EAAE,EAAE,GAChB,SAAG,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;QAEpB,OAAO,IAAI,CAAA;;;gCAGiB,EAAE,KAAK,EAAE,IAAI,EAAE;;YAEnC,IAAI,CAAC,MAAM,KAAK,UAAU;YAC1B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,IAAI,CAAA,kDAAkD,IAAI,KAAK,EAAE,SAAS;;gDAExC,IAAI,WAAW,IAAI;;KAE9D,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\n/**\n * Basic card displaying webhook log (`fx:webhook_log`) info.\n *\n * @element foxy-webhook-log-card\n * @since 1.17.0\n */\nexport class WebhookLogCard extends TranslatableMixin(InternalCard, 'webhook-log-card')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n layout: {},\n };\n }\n\n /** When set to \"resource\", doesn't render resource type and ID. */\n layout: null | 'resource' = null;\n\n renderBody(): TemplateResult {\n const {\n response_body: body,\n response_code: code,\n resource_type: type,\n date_created: date,\n resource_id: id,\n } = this.data ?? {};\n\n return html`\n <div class=\"leading-none space-y-xs\">\n <p class=\"flex justify-between items-center\">\n <foxy-i18n .options=${{ value: date }} class=\"font-medium\" infer=\"\" key=\"date\">\n </foxy-i18n>\n ${this.layout === 'resource'\n ? ''\n : html`<span class=\"text-xs text-tertiary capitalize\">${type} #${id}</span>`}\n </p>\n <p class=\"text-secondary text-s\">HTTP ${code} • ${body}</p>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropertyDeclarations } from 'lit-element';
|
|
1
2
|
import type { TemplateResult } from 'lit-html';
|
|
2
3
|
import type { Data } from './types';
|
|
3
4
|
import { InternalCard } from '../../internal/InternalCard/InternalCard';
|
|
@@ -11,6 +12,9 @@ declare const Base: typeof InternalCard & import("lit-element").Constructor<impo
|
|
|
11
12
|
* @since 1.17.0
|
|
12
13
|
*/
|
|
13
14
|
export declare class WebhookStatusCard extends Base<Data> {
|
|
15
|
+
static get properties(): PropertyDeclarations;
|
|
16
|
+
/** When set to "resource", doesn't render resource type and ID. */
|
|
17
|
+
layout: null | 'resource';
|
|
14
18
|
renderBody(): TemplateResult;
|
|
15
19
|
}
|
|
16
20
|
export {};
|
|
@@ -11,31 +11,40 @@ const Base = TranslatableMixin(InternalCard, NS);
|
|
|
11
11
|
* @since 1.17.0
|
|
12
12
|
*/
|
|
13
13
|
export class WebhookStatusCard extends Base {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
/** When set to "resource", doesn't render resource type and ID. */
|
|
17
|
+
this.layout = null;
|
|
18
|
+
}
|
|
19
|
+
static get properties() {
|
|
20
|
+
return {
|
|
21
|
+
...super.properties,
|
|
22
|
+
layout: {},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
14
25
|
renderBody() {
|
|
15
|
-
var _a
|
|
16
|
-
const status = (_a = this.data)
|
|
26
|
+
var _a;
|
|
27
|
+
const { resource_type: type, date_created: date, resource_id: id, status } = (_a = this.data) !== null && _a !== void 0 ? _a : {};
|
|
17
28
|
return html `
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
.options=${{ value:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</
|
|
26
|
-
|
|
27
|
-
<foxy-i18n
|
|
29
|
+
<div class="leading-none space-y-xs">
|
|
30
|
+
<p class="flex justify-between items-center">
|
|
31
|
+
<foxy-i18n .options=${{ value: date }} class="font-medium" infer="" key="date">
|
|
32
|
+
</foxy-i18n>
|
|
33
|
+
${this.layout === 'resource'
|
|
34
|
+
? ''
|
|
35
|
+
: html `<span class="text-xs text-tertiary capitalize">${type} #${id}</span>`}
|
|
36
|
+
</p>
|
|
37
|
+
<p
|
|
28
38
|
class=${classMap({
|
|
29
39
|
'text-secondary': status === 'pending',
|
|
30
40
|
'text-success': status === 'successful',
|
|
31
41
|
'text-error': status === 'failed',
|
|
32
42
|
'text-s': true,
|
|
33
43
|
})}
|
|
34
|
-
infer=""
|
|
35
|
-
key="status_${status}"
|
|
36
44
|
>
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
<foxy-i18n infer="" key="status_${status}"></foxy-i18n>
|
|
46
|
+
</p>
|
|
47
|
+
</div>
|
|
39
48
|
`;
|
|
40
49
|
}
|
|
41
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookStatusCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookStatusCard/WebhookStatusCard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebhookStatusCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookStatusCard/WebhookStatusCard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,qBAAqB,CAAC;AACjC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,IAAU;IAAjD;;QAQE,mEAAmE;QACnE,WAAM,GAAsB,IAAI,CAAC;IA2BnC,CAAC;IAnCC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAKD,UAAU;;QACR,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,SAAG,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;QAE7F,OAAO,IAAI,CAAA;;;gCAGiB,EAAE,KAAK,EAAE,IAAI,EAAE;;YAEnC,IAAI,CAAC,MAAM,KAAK,UAAU;YAC1B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,IAAI,CAAA,kDAAkD,IAAI,KAAK,EAAE,SAAS;;;kBAGtE,QAAQ,CAAC;YACf,gBAAgB,EAAE,MAAM,KAAK,SAAS;YACtC,cAAc,EAAE,MAAM,KAAK,YAAY;YACvC,YAAY,EAAE,MAAM,KAAK,QAAQ;YACjC,QAAQ,EAAE,IAAI;SACf,CAAC;;4CAEgC,MAAM;;;KAG7C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'webhook-status-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying webhook status (`fx:webhook_status`) info.\n *\n * @element foxy-webhook-status-card\n * @since 1.17.0\n */\nexport class WebhookStatusCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n layout: {},\n };\n }\n\n /** When set to \"resource\", doesn't render resource type and ID. */\n layout: null | 'resource' = null;\n\n renderBody(): TemplateResult {\n const { resource_type: type, date_created: date, resource_id: id, status } = this.data ?? {};\n\n return html`\n <div class=\"leading-none space-y-xs\">\n <p class=\"flex justify-between items-center\">\n <foxy-i18n .options=${{ value: date }} class=\"font-medium\" infer=\"\" key=\"date\">\n </foxy-i18n>\n ${this.layout === 'resource'\n ? ''\n : html`<span class=\"text-xs text-tertiary capitalize\">${type} #${id}</span>`}\n </p>\n <p\n class=${classMap({\n 'text-secondary': status === 'pending',\n 'text-success': status === 'successful',\n 'text-error': status === 'failed',\n 'text-s': true,\n })}\n >\n <foxy-i18n infer=\"\" key=\"status_${status}\"></foxy-i18n>\n </p>\n </div>\n `;\n }\n}\n"]}
|