@foxy.io/elements 1.36.0-beta.2 → 1.36.0-beta.4
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-cart-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +27 -13
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/shared-231687fd.js +1 -0
- package/dist/cdn/{shared-5a9e9e89.js → shared-82e82908.js} +1 -1
- package/dist/cdn/shared-9ca85d1e.js +1 -0
- package/dist/cdn/translations/customer-portal/de.json +18 -0
- package/dist/cdn/translations/customer-portal/en.json +18 -0
- package/dist/cdn/translations/customer-portal/es.json +18 -0
- package/dist/cdn/translations/customer-portal/fr.json +18 -0
- package/dist/cdn/translations/customer-portal/nl.json +18 -0
- package/dist/cdn/translations/customer-portal/pl.json +18 -0
- package/dist/cdn/translations/customer-portal/sv.json +18 -0
- package/dist/cdn/translations/customer-portal/zh-hk.json +18 -0
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js +3 -7
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js.map +1 -1
- package/dist/elements/public/CartForm/types.d.ts +1 -9
- package/dist/elements/public/CartForm/types.js.map +1 -1
- package/dist/elements/public/CustomerPortal/CustomerPortal.d.ts +4 -0
- package/dist/elements/public/CustomerPortal/CustomerPortal.js +48 -13
- package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +7 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.d.ts +25 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js +72 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js.map +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
- package/dist/elements/public/CustomerPortal/index.d.ts +2 -0
- package/dist/elements/public/CustomerPortal/index.js +4 -0
- package/dist/elements/public/CustomerPortal/index.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/types.d.ts +1 -3
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js +7 -7
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js.map +1 -1
- package/dist/elements/public/StoreForm/types.d.ts +4 -38
- package/dist/elements/public/StoreForm/types.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +1 -3
- package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +13 -17
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/UserCard/UserCard.js +0 -2
- package/dist/elements/public/UserCard/UserCard.js.map +1 -1
- package/dist/elements/public/UserInvitationCard/types.d.ts +3 -1
- package/dist/elements/public/UserInvitationCard/types.js +1 -1
- package/dist/elements/public/UserInvitationCard/types.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/types.d.ts +2 -41
- package/dist/elements/public/UserInvitationForm/types.js.map +1 -1
- package/package.json +3 -3
- package/dist/cdn/shared-0e156ee7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceR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;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\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 { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,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,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC/F,IAAI,WAAW,GAAG,EAAE,CAAC;YAErB,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;gBAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAA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I,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\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 { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date && host.data.end_date !== '0000-00-00';\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import '@polymer/iron-icons/editor-icons';
|
|
|
2
2
|
import '@vaadin/vaadin-button';
|
|
3
3
|
import '@polymer/iron-icons';
|
|
4
4
|
import '@polymer/iron-icon';
|
|
5
|
+
import '../../internal/InternalPasswordControl/index';
|
|
5
6
|
import '../../internal/InternalSandbox/index';
|
|
6
7
|
import '../../internal/InternalForm/index';
|
|
7
8
|
import '../AccessRecoveryForm/index';
|
|
@@ -15,6 +16,7 @@ import '../CustomerForm/index';
|
|
|
15
16
|
import '../SignInForm/index';
|
|
16
17
|
import '../FormDialog/index';
|
|
17
18
|
import '../Spinner/index';
|
|
19
|
+
import '../I18n/index';
|
|
18
20
|
import '../Customer/index';
|
|
19
21
|
import { CustomerPortal } from './CustomerPortal';
|
|
20
22
|
export { CustomerPortal };
|
|
@@ -2,6 +2,7 @@ import '@polymer/iron-icons/editor-icons';
|
|
|
2
2
|
import '@vaadin/vaadin-button';
|
|
3
3
|
import '@polymer/iron-icons';
|
|
4
4
|
import '@polymer/iron-icon';
|
|
5
|
+
import "../../internal/InternalPasswordControl/index.js";
|
|
5
6
|
import "../../internal/InternalSandbox/index.js";
|
|
6
7
|
import "../../internal/InternalForm/index.js";
|
|
7
8
|
import "../AccessRecoveryForm/index.js";
|
|
@@ -15,6 +16,7 @@ import "../CustomerForm/index.js";
|
|
|
15
16
|
import "../SignInForm/index.js";
|
|
16
17
|
import "../FormDialog/index.js";
|
|
17
18
|
import "../Spinner/index.js";
|
|
19
|
+
import "../I18n/index.js";
|
|
18
20
|
import "../Customer/index.js";
|
|
19
21
|
import { CustomerPortal } from "./CustomerPortal.js";
|
|
20
22
|
import { InternalCustomerPortalLink } from "./InternalCustomerPortalLink.js";
|
|
@@ -22,8 +24,10 @@ import { InternalCustomerPortalLoggedInView } from "./InternalCustomerPortalLogg
|
|
|
22
24
|
import { InternalCustomerPortalLoggedOutView } from "./InternalCustomerPortalLoggedOutView.js";
|
|
23
25
|
import { InternalCustomerPortalSubscriptions } from "./InternalCustomerPortalSubscriptions.js";
|
|
24
26
|
import { InternalCustomerPortalTransactions } from "./InternalCustomerPortalTransactions.js";
|
|
27
|
+
import { InternalCustomerPortalPasswordResetView } from "./InternalCustomerPortalPasswordResetView.js";
|
|
25
28
|
customElements.define('foxy-internal-customer-portal-logged-in-view', InternalCustomerPortalLoggedInView);
|
|
26
29
|
customElements.define('foxy-internal-customer-portal-logged-out-view', InternalCustomerPortalLoggedOutView);
|
|
30
|
+
customElements.define('foxy-internal-customer-portal-password-reset-view', InternalCustomerPortalPasswordResetView);
|
|
27
31
|
customElements.define('foxy-internal-customer-portal-subscriptions', InternalCustomerPortalSubscriptions);
|
|
28
32
|
customElements.define('foxy-internal-customer-portal-transactions', InternalCustomerPortalTransactions);
|
|
29
33
|
customElements.define('foxy-internal-customer-portal-link', InternalCustomerPortalLink);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,iDAA8C;AAC9C,8CAA2C;AAC3C,wCAAqC;AACrC,uCAAoC;AACpC,uCAAoC;AACpC,sCAAmC;AACnC,sCAAmC;AACnC,qCAAkC;AAClC,oCAAiC;AACjC,kCAA+B;AAC/B,gCAA6B;AAC7B,gCAA6B;AAC7B,6BAA0B;AAC1B,8BAA2B;AAE3B,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,EAAE,0BAA0B,EAAE,w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AC;AAEF,cAAc,CAAC,MAAM,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC;AAExF,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import '@polymer/iron-icons/editor-icons';\nimport '@vaadin/vaadin-button';\nimport '@polymer/iron-icons';\nimport '@polymer/iron-icon';\nimport '../../internal/InternalPasswordControl/index';\nimport '../../internal/InternalSandbox/index';\nimport '../../internal/InternalForm/index';\nimport '../AccessRecoveryForm/index';\nimport '../PaymentMethodCard/index';\nimport '../TransactionsTable/index';\nimport '../SubscriptionCard/index';\nimport '../SubscriptionForm/index';\nimport '../CollectionPages/index';\nimport '../CollectionPage/index';\nimport '../CustomerForm/index';\nimport '../SignInForm/index';\nimport '../FormDialog/index';\nimport '../Spinner/index';\nimport '../I18n/index';\nimport '../Customer/index';\n\nimport { CustomerPortal } from './CustomerPortal';\nimport { InternalCustomerPortalLink } from './InternalCustomerPortalLink';\nimport { InternalCustomerPortalLoggedInView } from './InternalCustomerPortalLoggedInView';\nimport { InternalCustomerPortalLoggedOutView } from './InternalCustomerPortalLoggedOutView';\nimport { InternalCustomerPortalSubscriptions } from './InternalCustomerPortalSubscriptions';\nimport { InternalCustomerPortalTransactions } from './InternalCustomerPortalTransactions';\nimport { InternalCustomerPortalPasswordResetView } from './InternalCustomerPortalPasswordResetView';\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-in-view',\n InternalCustomerPortalLoggedInView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-out-view',\n InternalCustomerPortalLoggedOutView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-password-reset-view',\n InternalCustomerPortalPasswordResetView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-subscriptions',\n InternalCustomerPortalSubscriptions\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-transactions',\n InternalCustomerPortalTransactions\n);\n\ncustomElements.define('foxy-internal-customer-portal-link', InternalCustomerPortalLink);\n\ncustomElements.define('foxy-customer-portal', CustomerPortal);\n\nexport { CustomerPortal };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n"]}
|
|
@@ -20,7 +20,7 @@ export function compose(params) {
|
|
|
20
20
|
id: 'config',
|
|
21
21
|
name: 'Configuration',
|
|
22
22
|
type: 'select',
|
|
23
|
-
description: '
|
|
23
|
+
description: '',
|
|
24
24
|
default_value: 'disabled',
|
|
25
25
|
options: [
|
|
26
26
|
{ name: 'Disabled', value: 'disabled' },
|
|
@@ -29,19 +29,19 @@ export function compose(params) {
|
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
id: '
|
|
33
|
-
name: '
|
|
32
|
+
id: 'site_key',
|
|
33
|
+
name: 'Site Key',
|
|
34
34
|
type: 'text',
|
|
35
35
|
optional: true,
|
|
36
|
-
description: '
|
|
36
|
+
description: '',
|
|
37
37
|
default_value: '',
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
id: '
|
|
41
|
-
name: '
|
|
40
|
+
id: 'private_key',
|
|
41
|
+
name: 'Secret Key',
|
|
42
42
|
type: 'text',
|
|
43
43
|
optional: true,
|
|
44
|
-
description: '
|
|
44
|
+
description: '',
|
|
45
45
|
default_value: '',
|
|
46
46
|
},
|
|
47
47
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"available_fraud_protections.js","sourceRoot":"","sources":["../../../../../../src/elements/public/PaymentsApi/api/composers/available_fraud_protections.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,qBAAqB,QAAQ,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAE3F,MAAM,MAAM,GAAwC;QAClD,QAAQ,EAAE;YACR,IAAI,EAAE,kBAAkB;YACxB,wBAAwB,EAAE,IAAI;YAC9B,IAAI,EAAE,IAAI;SACX;QACD,gBAAgB,EAAE;YAChB,IAAI,EAAE,kBAAkB;YACxB,wBAAwB,EAAE,KAAK;YAC/B,IAAI,EAAE;gBACJ,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,EAAE;wBACN,SAAS,EAAE,EAAE;wBACb,MAAM,EAAE;4BACN;gCACE,EAAE,EAAE,QAAQ;gCACZ,IAAI,EAAE,eAAe;gCACrB,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"available_fraud_protections.js","sourceRoot":"","sources":["../../../../../../src/elements/public/PaymentsApi/api/composers/available_fraud_protections.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC1E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,qBAAqB,QAAQ,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAE3F,MAAM,MAAM,GAAwC;QAClD,QAAQ,EAAE;YACR,IAAI,EAAE,kBAAkB;YACxB,wBAAwB,EAAE,IAAI;YAC9B,IAAI,EAAE,IAAI;SACX;QACD,gBAAgB,EAAE;YAChB,IA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AAM;gCACZ,WAAW,EAAE,+BAA+B;gCAC5C,aAAa,EAAE,EAAE;6BAClB;4BACD;gCACE,EAAE,EAAE,kBAAkB;gCACtB,IAAI,EAAE,kBAAkB;gCACxB,IAAI,EAAE,QAAQ;gCACd,WAAW,EACT,gGAAgG;gCAClG,aAAa,EAAE,EAAE;gCACjB,OAAO,EAAE;oCACP,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oCACnC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;iCACtC;6BACF;yBACF;qBACF;iBACF;aACF;SACF;KACF,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;QACzB,MAAM,EAAE,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC7C,IAAI,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC;KACzE;IAED,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { AvailableFraudProtections, FraudProtection } from '../types';\n\nexport type Params = {\n fraudProtections?: FraudProtection[];\n paymentPresetId: string;\n base: string;\n};\n\nexport function compose(params: Params): AvailableFraudProtections {\n const { paymentPresetId: presetId, fraudProtections: fps, base } = params;\n const selfURL = new URL(`./payment_presets/${presetId}/available_fraud_protections`, base);\n\n const values: AvailableFraudProtections['values'] = {\n minfraud: {\n name: 'MaxMind minFraud',\n uses_rejection_threshold: true,\n json: null,\n },\n google_recaptcha: {\n name: 'Google reCAPTCHA',\n uses_rejection_threshold: false,\n json: {\n blocks: [\n {\n id: '',\n parent_id: '',\n fields: [\n {\n id: 'config',\n name: 'Configuration',\n type: 'select',\n description: '',\n default_value: 'disabled',\n options: [\n { name: 'Disabled', value: 'disabled' },\n { name: 'Always enabled', value: 'enabled_always' },\n { name: 'Enabled by errors', value: 'enabled_by_errors' },\n ],\n },\n {\n id: 'site_key',\n name: 'Site Key',\n type: 'text',\n optional: true,\n description: '',\n default_value: '',\n },\n {\n id: 'private_key',\n name: 'Secret Key',\n type: 'text',\n optional: true,\n description: '',\n default_value: '',\n },\n ],\n },\n ],\n },\n },\n custom_precheckout_hook: {\n name: 'Pre-Checkout Webhook',\n uses_rejection_threshold: false,\n json: {\n blocks: [\n {\n id: '',\n parent_id: '',\n fields: [\n {\n id: 'enabled',\n name: 'Enabled',\n type: 'checkbox',\n default_value: false,\n },\n {\n id: 'url',\n name: 'URL',\n type: 'text',\n description: 'Url of your Pre-Checkout Hook',\n default_value: '',\n },\n {\n id: 'failure_handling',\n name: 'Failure handling',\n type: 'select',\n description:\n 'Determines what happens to the checkout submission if your webhook fails to respond correctly.',\n default_value: '',\n options: [\n { name: 'Reject', value: 'reject' },\n { name: 'Approve', value: 'approve' },\n ],\n },\n ],\n },\n ],\n },\n },\n };\n\n for (const type in values) {\n const fp = fps?.find(fp => fp.type === type);\n if (fp) values[type].conflict = { type: fp.type, name: fp.description };\n }\n\n return { _links: { self: { href: selfURL.toString() } }, values };\n}\n"]}
|
|
@@ -1,41 +1,7 @@
|
|
|
1
1
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
2
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
+
import type { StoreCustomDisplayIdConfigJson, StoreSmtpConfigJson, StoreWebhookKeyJson } from '@foxy.io/sdk/dist/types/backend/Rels';
|
|
3
4
|
export declare type Data = Resource<Rels.Store>;
|
|
4
|
-
export declare type ParsedWebhookKey =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
api_legacy: string;
|
|
8
|
-
sso: string;
|
|
9
|
-
};
|
|
10
|
-
export declare type ParsedSmtpConfig = {
|
|
11
|
-
username: string;
|
|
12
|
-
password: string;
|
|
13
|
-
security: string;
|
|
14
|
-
host: string;
|
|
15
|
-
port: string;
|
|
16
|
-
};
|
|
17
|
-
export declare type ParsedCustomDisplayIdConfig = {
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
start: string;
|
|
20
|
-
length: string;
|
|
21
|
-
prefix: string;
|
|
22
|
-
suffix: string;
|
|
23
|
-
transaction_journal_entries: {
|
|
24
|
-
enabled: boolean;
|
|
25
|
-
transaction_separator: string;
|
|
26
|
-
log_detail_request_types: {
|
|
27
|
-
transaction_authcapture: {
|
|
28
|
-
prefix: string;
|
|
29
|
-
};
|
|
30
|
-
transaction_capture: {
|
|
31
|
-
prefix: string;
|
|
32
|
-
};
|
|
33
|
-
transaction_refund: {
|
|
34
|
-
prefix: string;
|
|
35
|
-
};
|
|
36
|
-
transaction_void: {
|
|
37
|
-
prefix: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
5
|
+
export declare type ParsedWebhookKey = StoreWebhookKeyJson;
|
|
6
|
+
export declare type ParsedSmtpConfig = StoreSmtpConfigJson;
|
|
7
|
+
export declare type ParsedCustomDisplayIdConfig = StoreCustomDisplayIdConfigJson;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/StoreForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.Store>;\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/StoreForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type {\n StoreCustomDisplayIdConfigJson,\n StoreSmtpConfigJson,\n StoreWebhookKeyJson,\n} from '@foxy.io/sdk/dist/types/backend/Rels';\n\nexport type Data = Resource<Rels.Store>;\nexport type ParsedWebhookKey = StoreWebhookKeyJson;\nexport type ParsedSmtpConfig = StoreSmtpConfigJson;\nexport type ParsedCustomDisplayIdConfig = StoreCustomDisplayIdConfigJson;\n"]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { Resource } from '@foxy.io/sdk/core';
|
|
2
2
|
import type { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
-
export declare type Data =
|
|
4
|
-
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists' | '';
|
|
5
|
-
};
|
|
3
|
+
export declare type Data = Resource<Rels.SubscriptionSettings>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionSettingsForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data =
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionSettingsForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.SubscriptionSettings>;\n"]}
|
|
@@ -29,8 +29,6 @@ export class Transaction extends Base {
|
|
|
29
29
|
onClick: async (selection) => {
|
|
30
30
|
if (!this.data)
|
|
31
31
|
return;
|
|
32
|
-
// TODO remove ts-expect-error when SDK has the types
|
|
33
|
-
// @ts-expect-error SDK types are incomplete
|
|
34
32
|
const url = this.data._links['fx:send_webhooks'].href;
|
|
35
33
|
const api = new Transaction.API(this);
|
|
36
34
|
const response = await api.fetch(url, {
|
|
@@ -201,7 +199,7 @@ export class Transaction extends Base {
|
|
|
201
199
|
`;
|
|
202
200
|
}
|
|
203
201
|
renderBody() {
|
|
204
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
205
203
|
let shipmentsLink = undefined;
|
|
206
204
|
let webhooksLink = undefined;
|
|
207
205
|
let itemsLink = undefined;
|
|
@@ -210,9 +208,7 @@ export class Transaction extends Base {
|
|
|
210
208
|
if (this.data) {
|
|
211
209
|
try {
|
|
212
210
|
const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);
|
|
213
|
-
|
|
214
|
-
// @ts-expect-error SDK doesn't have the types
|
|
215
|
-
const webhooksUrl = new URL((_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data._links['fx:webhooks'].href) !== null && _b !== void 0 ? _b : '');
|
|
211
|
+
const webhooksUrl = new URL((_c = (_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:webhooks'].href) !== null && _c !== void 0 ? _c : '');
|
|
216
212
|
const itemsUrl = new URL(this.data._links['fx:items'].href);
|
|
217
213
|
shipmentsUrl.searchParams.set('zoom', 'items:item_category');
|
|
218
214
|
webhooksUrl.searchParams.set('event_resource', 'transaction');
|
|
@@ -221,19 +217,19 @@ export class Transaction extends Base {
|
|
|
221
217
|
webhooksLink = webhooksUrl.toString();
|
|
222
218
|
itemsLink = itemsUrl.toString();
|
|
223
219
|
}
|
|
224
|
-
catch (
|
|
220
|
+
catch (_s) {
|
|
225
221
|
//
|
|
226
222
|
}
|
|
227
223
|
}
|
|
228
224
|
return html `
|
|
229
225
|
${this.renderHeader()}
|
|
230
|
-
${alertStatuses.includes((
|
|
226
|
+
${alertStatuses.includes((_e = (_d = this.data) === null || _d === void 0 ? void 0 : _d.status) !== null && _e !== void 0 ? _e : '')
|
|
231
227
|
? html `
|
|
232
228
|
<p
|
|
233
229
|
class="leading-xs text-body rounded bg-error-10 block"
|
|
234
230
|
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
235
231
|
>
|
|
236
|
-
<foxy-i18n infer="header" key="alert_status_${(
|
|
232
|
+
<foxy-i18n infer="header" key="alert_status_${(_f = this.data) === null || _f === void 0 ? void 0 : _f.status}"></foxy-i18n>
|
|
237
233
|
</p>
|
|
238
234
|
`
|
|
239
235
|
: ''}
|
|
@@ -257,9 +253,9 @@ export class Transaction extends Base {
|
|
|
257
253
|
.related=${[this.href]}
|
|
258
254
|
.itemProps=${{ 'locale-codes': this.localeCodes }}
|
|
259
255
|
.formProps=${{
|
|
260
|
-
'item-categories': (
|
|
256
|
+
'item-categories': (_h = (_g = this.__storeLoader) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h._links['fx:item_categories'].href,
|
|
261
257
|
'locale-codes': this.localeCodes,
|
|
262
|
-
'store': (
|
|
258
|
+
'store': (_j = this.data) === null || _j === void 0 ? void 0 : _j._links['fx:store'].href,
|
|
263
259
|
}}
|
|
264
260
|
>
|
|
265
261
|
</foxy-internal-async-list-control>
|
|
@@ -270,7 +266,7 @@ export class Transaction extends Base {
|
|
|
270
266
|
|
|
271
267
|
<foxy-internal-async-list-control
|
|
272
268
|
infer="billing-addresses"
|
|
273
|
-
first=${ifDefined((
|
|
269
|
+
first=${ifDefined((_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:billing_addresses'].href)}
|
|
274
270
|
item="foxy-billing-address-card"
|
|
275
271
|
form="foxy-address-form"
|
|
276
272
|
hide-create-button
|
|
@@ -281,7 +277,7 @@ export class Transaction extends Base {
|
|
|
281
277
|
|
|
282
278
|
<foxy-internal-async-list-control
|
|
283
279
|
infer="payments"
|
|
284
|
-
first=${ifDefined((
|
|
280
|
+
first=${ifDefined((_l = this.data) === null || _l === void 0 ? void 0 : _l._links['fx:payments'].href)}
|
|
285
281
|
item="foxy-payment-card"
|
|
286
282
|
.itemProps=${{
|
|
287
283
|
'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,
|
|
@@ -293,7 +289,7 @@ export class Transaction extends Base {
|
|
|
293
289
|
<foxy-internal-async-list-control
|
|
294
290
|
infer="custom-fields"
|
|
295
291
|
class="min-w-0"
|
|
296
|
-
first=${ifDefined((
|
|
292
|
+
first=${ifDefined((_m = this.data) === null || _m === void 0 ? void 0 : _m._links['fx:custom_fields'].href)}
|
|
297
293
|
limit="5"
|
|
298
294
|
form="foxy-custom-field-form"
|
|
299
295
|
item="foxy-custom-field-card"
|
|
@@ -304,7 +300,7 @@ export class Transaction extends Base {
|
|
|
304
300
|
<foxy-internal-async-list-control
|
|
305
301
|
infer="attributes"
|
|
306
302
|
class="min-w-0"
|
|
307
|
-
first=${ifDefined((
|
|
303
|
+
first=${ifDefined((_o = this.data) === null || _o === void 0 ? void 0 : _o._links['fx:attributes'].href)}
|
|
308
304
|
limit="5"
|
|
309
305
|
form="foxy-attribute-form"
|
|
310
306
|
item="foxy-attribute-card"
|
|
@@ -337,7 +333,7 @@ export class Transaction extends Base {
|
|
|
337
333
|
<foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control>
|
|
338
334
|
<foxy-internal-transaction-post-action-control
|
|
339
335
|
infer="process-webhook"
|
|
340
|
-
href=${ifDefined((
|
|
336
|
+
href=${ifDefined((_q = (_p = this.data) === null || _p === void 0 ? void 0 : _p._links['fx:process_webhook']) === null || _q === void 0 ? void 0 : _q.href)}
|
|
341
337
|
>
|
|
342
338
|
</foxy-internal-transaction-post-action-control>
|
|
343
339
|
</foxy-internal-summary-control>
|
|
@@ -345,7 +341,7 @@ export class Transaction extends Base {
|
|
|
345
341
|
<foxy-nucleon
|
|
346
342
|
class="hidden"
|
|
347
343
|
infer=""
|
|
348
|
-
href=${ifDefined((
|
|
344
|
+
href=${ifDefined((_r = this.data) === null || _r === void 0 ? void 0 : _r._links['fx:store'].href)}
|
|
349
345
|
id="storeLoader"
|
|
350
346
|
@update=${() => this.requestUpdate()}
|
|
351
347
|
>
|
|
@@ -1 +1 @@
|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BAMhB,IAAI,CAAC,qBAAqB;qBAC5B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;qBAC7B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;iBAQjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;;;;;;;;eAQ1D,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n // TODO remove ts-expect-error when SDK has the types\n // @ts-expect-error SDK types are incomplete\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n // TODO: Remove the ts-expect-error comment when SDK has the types\n // @ts-expect-error SDK doesn't have the types\n const webhooksUrl = new URL(this.__storeLoader?.data._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAYE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAA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,CAAC,IAAI,0CAAE,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWzD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;;gBAOO,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUlD,SAAS,CAAC,aAAa,CAAC;;;;;;;gBAOxB,SAAS,CAAC,YAAY,CAAC;;;;;;uBAMhB,IAAI,CAAC,qBAAqB;qBAC5B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;qBAC7B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;iBAQjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;;;;;;;;eAQ1D,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const webhooksUrl = new URL(this.__storeLoader?.data?._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|
|
@@ -75,8 +75,6 @@ export class UserCard extends Base {
|
|
|
75
75
|
try {
|
|
76
76
|
if (!this.showInvitations)
|
|
77
77
|
return;
|
|
78
|
-
// TODO remove this when SDK has types for invitations.
|
|
79
|
-
// @ts-expect-error SDK does not have types for invitations yet.
|
|
80
78
|
const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:user_invitations'].href) !== null && _b !== void 0 ? _b : '');
|
|
81
79
|
url.searchParams.set('status', 'sent');
|
|
82
80
|
url.searchParams.set('limit', '1');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserCard.js","sourceRoot":"","sources":["../../../../src/elements/public/UserCard/UserCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,0CAAuC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,WAAW,CAAC;AACvB,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAU;IAAxC;;QAQE,0GAA0G;QAC1G,oBAAe,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"UserCard.js","sourceRoot":"","sources":["../../../../src/elements/public/UserCard/UserCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,2CAAwC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,0CAAuC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,WAAW,CAAC;AACvB,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,EAA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iBAAiB,CAAC;;kBAE9B,IAAI,CAAC,aAAa;;;KAG/B,CAAC;IACJ,CAAC;IAED,IAAY,mBAAmB;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,oBAAoB,CAAC,CAAC;IACrE,CAAC;IAED,IAAY,iBAAiB;;QAC3B,IAAI;YACF,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,OAAO;YAClC,MAAM,GAAG,GAAG,IAAI,GAAG,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,qBAAqB,EAAE,IAAI,mCAAI,EAAE,CAAC,CAAC;YACzE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACvC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACnC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO;SACR;IACH,CAAC;IAEO,KAAK,CAAC,CAAC,aAAa,CAAC,KAAc;QACzC,MAAM,IAAI,CAAA,wDAAwD,CAAC;QAEnE,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,CAAA;;;gBAGA,MAAM,cAAc,CAAC,KAAK,CAAC;;;OAGpC,CAAC;SACH;IACH,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { getGravatarUrl } from '../../../utils/get-gravatar-url';\nimport { asyncReplace } from 'lit-html/directives/async-replace';\nimport { TwoLineCard } from '../CustomFieldCard/TwoLineCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nconst NS = 'user-card';\nconst Base = TranslatableMixin(TwoLineCard, NS);\n\n/**\n * Card element representing a `fx:user` resource.\n *\n * @element foxy-user-card\n * @since 1.22.0\n */\nexport class UserCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n showInvitations: { type: Boolean, attribute: 'show-invitations' },\n };\n }\n\n /** When true, displays the number of unanswered invitations next to profile picture if there are some. */\n showInvitations = false;\n\n renderBody(): TemplateResult {\n const invitationsCount = this.__invitationsLoader?.data?.total_items ?? 0;\n\n return html`\n <div\n class=\"flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <div class=\"relative flex-shrink-0\">\n ${asyncReplace(this.__getGravatar(this.data?.email))}\n <span\n data-testid=\"invitations-count\"\n style=\"min-height: 1.5em; min-width: 1.5em; border-radius: 1.5em; left: calc(100% - 1em); top: -0.5em;\"\n class=${classMap({\n 'flex items-center justify-center bg-error text-error-contrast': true,\n 'font-medium px-xs leading-none text-xs absolute transform': true,\n 'scale-0': !this.showInvitations || invitationsCount === 0,\n })}\n >\n ${invitationsCount}\n </span>\n </div>\n <div class=\"min-w-0 flex-1\">\n ${super.renderBody({\n title: data => {\n const name = [data.first_name.trim(), data.last_name.trim()];\n return html`${name.filter(v => !!v).join(' ') || this.t('no_name')}`;\n },\n subtitle: data => html`${data.email}`,\n })}\n </div>\n </div>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__invitationsHref)}\n id=\"invitationsLoader\"\n @update=${this.requestUpdate}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __invitationsLoader() {\n type Loader = NucleonElement<Resource<Rels.UserInvitations>>;\n return this.renderRoot.querySelector<Loader>('#invitationsLoader');\n }\n\n private get __invitationsHref() {\n try {\n if (!this.showInvitations) return;\n const url = new URL(this.data?._links['fx:user_invitations'].href ?? '');\n url.searchParams.set('status', 'sent');\n url.searchParams.set('limit', '1');\n return url.toString();\n } catch {\n return;\n }\n }\n\n private async *__getGravatar(email?: string) {\n yield html`<div class=\"rounded-full w-s h-s bg-contrast-5\"></div>`;\n\n if (email) {\n yield html`\n <img\n class=\"rounded-full w-s h-s bg-contrast-5 shadow-xs\"\n src=${await getGravatarUrl(email)}\n alt=\"\"\n />\n `;\n }\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationCard/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/UserInvitationCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.UserInvitation>;\n"]}
|