@foxy.io/elements 1.24.0-beta.2 → 1.24.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.
Files changed (32) hide show
  1. package/dist/cdn/foxy-error-entry-card.js +1 -1
  2. package/dist/cdn/foxy-item-category-form.js +1 -1
  3. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  4. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  5. package/dist/cdn/foxy-store-form.js +1 -1
  6. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  7. package/dist/cdn/foxy-transaction-card.js +1 -1
  8. package/dist/cdn/foxy-webhook-form.js +1 -1
  9. package/dist/cdn/{shared-7995407d.js → shared-30bebd39.js} +1 -1
  10. package/dist/cdn/translations/error-entry-card/en.json +4 -0
  11. package/dist/cdn/translations/item-category-form/en.json +3 -3
  12. package/dist/cdn/translations/transaction-card/en.json +6 -6
  13. package/dist/cdn/translations/webhook-form/en.json +1 -1
  14. package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js +2 -1
  15. package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js.map +1 -1
  16. package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.d.ts +0 -1
  17. package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.js +34 -30
  18. package/dist/elements/public/ErrorEntryCard/ErrorEntryCard.js.map +1 -1
  19. package/dist/elements/public/ErrorEntryCard/ResourceViewer.js +9 -0
  20. package/dist/elements/public/ErrorEntryCard/ResourceViewer.js.map +1 -1
  21. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +6 -0
  22. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +48 -3
  23. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
  24. package/dist/elements/public/ItemCategoryForm/index.d.ts +1 -0
  25. package/dist/elements/public/ItemCategoryForm/index.js +1 -0
  26. package/dist/elements/public/ItemCategoryForm/index.js.map +1 -1
  27. package/dist/elements/public/TransactionCard/TransactionCard.js +13 -19
  28. package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
  29. package/dist/elements/public/WebhookForm/WebhookForm.d.ts +2 -0
  30. package/dist/elements/public/WebhookForm/WebhookForm.js +7 -0
  31. package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
  32. package/package.json +1 -1
@@ -41,7 +41,7 @@ class TransactionCard extends Base {
41
41
  <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>
42
42
  ${hasTotal || hasStatus
43
43
  ? html `
44
- <div class="flex items-center justify-between">
44
+ <div class="flex items-center justify-between gap-s">
45
45
  ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}
46
46
  </div>
47
47
  `
@@ -82,6 +82,7 @@ class TransactionCard extends Base {
82
82
  return transaction;
83
83
  }
84
84
  __renderTotal() {
85
+ var _a, _b;
85
86
  const data = this.data;
86
87
  let content;
87
88
  if (data) {
@@ -98,9 +99,11 @@ class TransactionCard extends Base {
98
99
  : 'fx:subscription' in data._links
99
100
  ? 'new_subscription'
100
101
  : 'new_order';
102
+ const source = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.substring(0, 3).toUpperCase();
101
103
  content = html `
102
- <foxy-i18n lang=${this.lang} key="type_${type}" ns=${this.ns}></foxy-i18n>
103
- <span> &bull; </span>
104
+ ${source ? html `<span title=${this.t(`source_${source}`)}>${source}</span>` : ''}
105
+ <foxy-i18n class="truncate" lang=${this.lang} key="type_${type}" ns=${this.ns}></foxy-i18n>
106
+ <span>&bull;</span>
104
107
  <foxy-i18n
105
108
  options=${JSON.stringify({ amount, currencyDisplay })}
106
109
  lang=${this.lang}
@@ -114,15 +117,15 @@ class TransactionCard extends Base {
114
117
  content = html `&ZeroWidthSpace;`;
115
118
  }
116
119
  return html `
117
- <div data-testid="total">
120
+ <div class="min-w-0" data-testid="total">
118
121
  ${this.renderTemplateOrSlot('total:before')}
119
- <div class="font-medium truncate">${content}</div>
122
+ <div class="font-medium flex items-center gap-xs">${content}</div>
120
123
  ${this.renderTemplateOrSlot('total:after')}
121
124
  </div>
122
125
  `;
123
126
  }
124
127
  __renderStatus() {
125
- var _a, _b, _c, _d, _e;
128
+ var _a, _b, _c, _d;
126
129
  const specialIcons = {
127
130
  completed: 'icons:done-all',
128
131
  refunded: 'icons:restore',
@@ -136,22 +139,13 @@ class TransactionCard extends Base {
136
139
  declined: 'text-error',
137
140
  };
138
141
  const status = ((_a = this.data) === null || _a === void 0 ? void 0 : _a.status) || 'completed';
139
- const source = (_b = this.data) === null || _b === void 0 ? void 0 : _b.source.substring(0, 3).toUpperCase();
140
142
  return html `
141
- <div data-testid="status">
143
+ <div class="flex-shrink-0" data-testid="status">
142
144
  ${this.renderTemplateOrSlot('status:before')}
143
145
 
144
146
  <div class="text-tertiary text-s flex items-center space-x-s">
145
- ${source
146
- ? html `
147
- <div class="bg-contrast-5 rounded-s px-xs" title=${this.t(`source_${source}`)}>
148
- ${source}
149
- </div>
150
- `
151
- : ''}
152
-
153
147
  <foxy-i18n
154
- options=${JSON.stringify({ value: (_c = this.data) === null || _c === void 0 ? void 0 : _c.transaction_date })}
148
+ options=${JSON.stringify({ value: (_b = this.data) === null || _b === void 0 ? void 0 : _b.transaction_date })}
155
149
  lang=${this.lang}
156
150
  key="time"
157
151
  ns=${this.ns}
@@ -160,9 +154,9 @@ class TransactionCard extends Base {
160
154
 
161
155
  <iron-icon
162
156
  data-testid="status-icon"
163
- class="icon-inline text-l ${(_d = specialColors[status]) !== null && _d !== void 0 ? _d : 'text-tertiary'}"
157
+ class="icon-inline text-l ${(_c = specialColors[status]) !== null && _c !== void 0 ? _c : 'text-tertiary'}"
164
158
  title=${this.t(`transaction_${status}`)}
165
- icon=${(_e = specialIcons[status]) !== null && _e !== void 0 ? _e : 'icons:schedule'}
159
+ icon=${(_d = specialIcons[status]) !== null && _d !== void 0 ? _d : 'icons:schedule'}
166
160
  >
167
161
  </iron-icon>
168
162
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,eAAgB,SAAQ,IAAU;IAAxC;;QACE,cAAS,GAAc,EAAE,CAAC;QAElB,sBAAiB,GAAG,EAAE,CAAC;IA0MjC,CAAC;IAxMC,MAAM;;QACJ,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAA;;oBAEK,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;;;;qBAId,QAAQ,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1E,QAAQ,IAAI,SAAS;YACrB,CAAC,CAAC,IAAI,CAAA;;oBAEE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAA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AAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpE,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;gBACjC,KAAK,EAAE,KAAK,CAAC,MAAM;aACpB,CAAC;YAEF,OAAO,GAAG,IAAI,CAAA;;oBAEA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;iBAC1B,IAAI,CAAC,IAAI;;eAEX,IAAI,CAAC,EAAE;;;OAGf,CAAC;SACH;aAAM;YACL,OAAO,GAAG,IAAI,CAAA,kBAAkB,CAAC;SAClC;QAED,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC;sDACH,OAAO;UACnD,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,cAAc,GAAG;YACvF,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC;QAE3B,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n const transaction = await super._sendGet();\n const storeLink = transaction._links['fx:store']?.href;\n\n if (typeof storeLink === 'string') {\n const store = await super._fetch<Resource<Rels.Store>>(storeLink);\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n } else {\n this.__currencyDisplay = 'symbol';\n }\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n const apiTypes = [\n 'subscription_cancellation',\n 'subscription_modification',\n 'subscription_renewal',\n 'updateinfo',\n ];\n\n const type = apiTypes.includes(data.type)\n ? data.type\n : 'fx:subscription' in data._links\n ? 'new_subscription'\n : 'new_order';\n\n content = html`\n <foxy-i18n lang=${this.lang} key=\"type_${type}\" ns=${this.ns}></foxy-i18n>\n <span> &bull; </span>\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-medium truncate\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n const source = this.data?.source.substring(0, 3).toUpperCase();\n\n return html`\n <div data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n ${source\n ? html`\n <div class=\"bg-contrast-5 rounded-s px-xs\" title=${this.t(`source_${source}`)}>\n ${source}\n </div>\n `\n : ''}\n\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`&ZeroWidthSpace;`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
1
+ {"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,cAAc,CAAC,i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oBAAoB,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,cAAc,GAAG;YACvF,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC;QAE3B,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between gap-s\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n const transaction = await super._sendGet();\n const storeLink = transaction._links['fx:store']?.href;\n\n if (typeof storeLink === 'string') {\n const store = await super._fetch<Resource<Rels.Store>>(storeLink);\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n } else {\n this.__currencyDisplay = 'symbol';\n }\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n const apiTypes = [\n 'subscription_cancellation',\n 'subscription_modification',\n 'subscription_renewal',\n 'updateinfo',\n ];\n\n const type = apiTypes.includes(data.type)\n ? data.type\n : 'fx:subscription' in data._links\n ? 'new_subscription'\n : 'new_order';\n\n const source = this.data?.source?.substring(0, 3).toUpperCase();\n\n content = html`\n ${source ? html`<span title=${this.t(`source_${source}`)}>${source}</span>` : ''}\n <foxy-i18n class=\"truncate\" lang=${this.lang} key=\"type_${type}\" ns=${this.ns}></foxy-i18n>\n <span>&bull;</span>\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div class=\"min-w-0\" data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-medium flex items-center gap-xs\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n\n return html`\n <div class=\"flex-shrink-0\" data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`&ZeroWidthSpace;`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { TemplateResult } from 'lit-html';
2
2
  import type { NucleonV8N } from '../NucleonElement/types';
3
3
  import type { Data } from './types';
4
+ import { BooleanSelector } from '@foxy.io/sdk/core';
4
5
  import { InternalForm } from '../../internal/InternalForm/InternalForm';
5
6
  declare const WebhookForm_base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
6
7
  defaultNS: string;
@@ -42,6 +43,7 @@ export declare class WebhookForm extends WebhookForm_base<Data> {
42
43
  static get v8n(): NucleonV8N<Data>;
43
44
  private __formats;
44
45
  private __eventResources;
46
+ get readonlySelector(): BooleanSelector;
45
47
  renderBody(): TemplateResult;
46
48
  }
47
49
  export {};
@@ -1,4 +1,5 @@
1
1
  import { TranslatableMixin } from "../../../mixins/translatable.js";
2
+ import { BooleanSelector } from '@foxy.io/sdk/core';
2
3
  import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
3
4
  import { html } from 'lit-html';
4
5
  /**
@@ -59,6 +60,12 @@ export class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')
59
60
  ({ encryption_key: v }) => !v || v.length <= 1000 || 'encryption-key:v8n_too_long',
60
61
  ];
61
62
  }
63
+ get readonlySelector() {
64
+ const alwaysMatch = [];
65
+ if (this.data)
66
+ alwaysMatch.push('event-resource');
67
+ return new BooleanSelector(`${super.readonlySelector} ${alwaysMatch.join(' ')}`.trim());
68
+ }
62
69
  renderBody() {
63
70
  return html `
64
71
  <foxy-internal-text-control infer="name"></foxy-internal-text-control>
@@ -1 +1 @@
1
- {"version":3,"file":"WebhookForm.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/WebhookForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAO;IAAtF;;QAaU,cAAS,GAAG;YAClB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAChC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;SACrC,CAAC;QAEM,qBAAgB,GAAG;YACzB,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,6BAA6B,EAAE;YAC/D,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,4BAA4B,EAAE;YAC7D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAE;SACxD,CAAC;IAwCJ,CAAC;IA9DC,MAAM,KAAK,GAAG;QACZ,OAAO;YACL,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,mBAAmB;YAC3C,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,mBAAmB;YAChE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,sBAAsB;YACjD,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAqB;YAC/C,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,kBAAkB;YAC5D,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,oBAAoB;YAChE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,6BAA6B;SACnF,CAAC;IACJ,CAAC;IAcD,UAAU;QACR,OAAO,IAAI,CAAA;;;2EAG4D,IAAI,CAAC,gBAAgB;;;;;;mEAM7B,IAAI,CAAC,SAAS;;;;;;QAMzE,IAAI,CAAC,IAAI;YACT,CAAC,CAAC,IAAI,CAAA;;sBAEQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI;;;;;;;;sBAQpC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI;;;;;;WAM3C;YACH,CAAC,CAAC,EAAE;QACJ,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing webhooks (`fx:webhook`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot event-resource:before\n * @slot event-resource:after\n *\n * @slot query:before\n * @slot query:after\n *\n * @slot url:before\n * @slot url:after\n *\n * @slot format:before\n * @slot format:after\n *\n * @slot encryption-key:before\n * @slot encryption-key:after\n *\n * @slot version:before\n * @slot version:after\n *\n * @slot statuses:before\n * @slot statuses:after\n *\n * @slot logs:before\n * @slot logs:after\n *\n * @element foxy-webhook-form\n * @since 1.17.0\n */\nexport class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')<Data> {\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 ({ version: v }) => !!v || 'version:v8n_required',\n ({ format: v }) => !!v || 'format:v8n_required',\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 || v.length <= 1000 || 'encryption-key:v8n_too_long',\n ];\n }\n\n private __formats = [\n { value: 'json', label: 'JSON' },\n { value: 'webflow', label: 'Webflow' },\n { value: 'zapier', label: 'Zapier' },\n ];\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 renderBody(): TemplateResult {\n return html`\n <foxy-internal-text-control infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"event-resource\" .options=${this.__eventResources}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"query\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"url\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"format\" .options=${this.__formats}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"encryption-key\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"version\"></foxy-internal-text-control>\n\n ${this.data\n ? html`\n <foxy-internal-async-details-control\n first=${this.data._links['fx:statuses'].href}\n infer=\"statuses\"\n limit=\"10\"\n item=\"foxy-webhook-status-card\"\n >\n </foxy-internal-async-details-control>\n\n <foxy-internal-async-details-control\n first=${this.data._links['fx:logs'].href}\n infer=\"logs\"\n limit=\"5\"\n item=\"foxy-webhook-log-card\"\n >\n </foxy-internal-async-details-control>\n `\n : ''}\n ${super.renderBody()}\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"WebhookForm.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookForm/WebhookForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAO;IAAtF;;QAaU,cAAS,GAAG;YAClB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAChC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;SACrC,CAAC;QAEM,qBAAgB,GAAG;YACzB,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,6BAA6B,EAAE;YAC/D,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,4BAA4B,EAAE;YAC7D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,yBAAyB,EAAE;SACxD,CAAC;IA8CJ,CAAC;IApEC,MAAM,KAAK,GAAG;QACZ,OAAO;YACL,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,mBAAmB;YAC3C,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM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,EAAE;QACJ,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html } from 'lit-html';\n\n/**\n * Form element for creating or editing webhooks (`fx:webhook`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot event-resource:before\n * @slot event-resource:after\n *\n * @slot query:before\n * @slot query:after\n *\n * @slot url:before\n * @slot url:after\n *\n * @slot format:before\n * @slot format:after\n *\n * @slot encryption-key:before\n * @slot encryption-key:after\n *\n * @slot version:before\n * @slot version:after\n *\n * @slot statuses:before\n * @slot statuses:after\n *\n * @slot logs:before\n * @slot logs:after\n *\n * @element foxy-webhook-form\n * @since 1.17.0\n */\nexport class WebhookForm extends TranslatableMixin(InternalForm, 'webhook-form')<Data> {\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 ({ version: v }) => !!v || 'version:v8n_required',\n ({ format: v }) => !!v || 'format:v8n_required',\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 || v.length <= 1000 || 'encryption-key:v8n_too_long',\n ];\n }\n\n private __formats = [\n { value: 'json', label: 'JSON' },\n { value: 'webflow', label: 'Webflow' },\n { value: 'zapier', label: 'Zapier' },\n ];\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 readonlySelector(): BooleanSelector {\n const alwaysMatch: string[] = [];\n if (this.data) alwaysMatch.push('event-resource');\n return new BooleanSelector(`${super.readonlySelector} ${alwaysMatch.join(' ')}`.trim());\n }\n\n renderBody(): TemplateResult {\n return html`\n <foxy-internal-text-control infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"event-resource\" .options=${this.__eventResources}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"query\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"url\"></foxy-internal-text-control>\n\n <foxy-internal-radio-group-control infer=\"format\" .options=${this.__formats}>\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control infer=\"encryption-key\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"version\"></foxy-internal-text-control>\n\n ${this.data\n ? html`\n <foxy-internal-async-details-control\n first=${this.data._links['fx:statuses'].href}\n infer=\"statuses\"\n limit=\"10\"\n item=\"foxy-webhook-status-card\"\n >\n </foxy-internal-async-details-control>\n\n <foxy-internal-async-details-control\n first=${this.data._links['fx:logs'].href}\n infer=\"logs\"\n limit=\"5\"\n item=\"foxy-webhook-log-card\"\n >\n </foxy-internal-async-details-control>\n `\n : ''}\n ${super.renderBody()}\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.24.0-beta.2",
4
+ "version": "1.24.0-beta.4",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",