@foxy.io/elements 1.24.1-beta.1 → 1.24.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/shared-fa7539af.js +46 -0
- package/dist/cdn/translations/admin-subscription-card/en.json +1 -0
- package/dist/cdn/translations/cart-form/en.json +2 -0
- package/dist/cdn/translations/customer/en.json +2 -0
- package/dist/cdn/translations/customer-portal/en.json +2 -0
- package/dist/cdn/translations/item-form/en.json +2 -0
- package/dist/cdn/translations/shipment-card/en.json +2 -0
- package/dist/cdn/translations/subscription-card/en.json +1 -0
- package/dist/cdn/translations/subscription-form/en.json +1 -0
- package/dist/cdn/translations/subscriptions-table/en.json +1 -0
- package/dist/cdn/translations/transaction/en.json +4 -0
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +17 -6
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
- package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +24 -12
- package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +11 -4
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
- package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +22 -22
- package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-f29d410a.js +0 -46
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionsTable.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/SubscriptionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,0BAAuB;AACvC,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,CAAO;IAA7F;;
|
|
1
|
+
{"version":3,"file":"SubscriptionsTable.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/SubscriptionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,0BAAuB;AACvC,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,CAAO;IAA7F;;QAyGE,YAAO,GAAG;YACR,kBAAkB,CAAC,WAAW;YAC9B,kBAAkB,CAAC,aAAa;YAChC,kBAAkB,CAAC,YAAY;YAC/B,kBAAkB,CAAC,iBAAiB;SACrC,CAAC;IACJ,CAAC;;AA9GQ,8BAAW,GAAiB;IACjC,IAAI,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QAE3D,OAAO,GAAG,CAAC,IAAI,CAAA;;;;iBAIJ,GAAG,CAAC,IAAI;uBACF,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;eACpE,GAAG,CAAC,EAAE;qBACA,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE;;;OAG/D,CAAC;IACJ,CAAC;CACF,C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AgC,CAAC,CAAC,CAAC,wBAAwB,CAAC;SAC9E;aAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAC1B,IAAI,GAAG,EAAE,CAAC;YACV,GAAG,GAAG,uBAAuB,CAAC;SAC/B;aAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE;YACjD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;YACvB,GAAG,GAAG,6BAA6B,CAAC;SACrC;aAAM;YACL,KAAK,GAAG,4BAA4B,CAAC;YACrC,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAClC,GAAG,GAAG,qBAAqB,CAAC;SAC7B;QAED,OAAO,IAAI,CAAA;;;iFAGgE,KAAK;iBACrE,IAAI;gBACL,GAAG;eACJ,EAAE;qBACI,EAAE,IAAI,EAAE;;;OAGtB,CAAC;IACJ,CAAC;CACF,CAAC;AAEK,oCAAiB,GAAiB;IACvC,IAAI,EAAE,GAAG,CAAC,EAAE;QACV,OAAO,GAAG,CAAC,IAAI,CAAA;;;;;iBAKJ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI;;;;mBAItC,GAAG,CAAC,IAAI;;iBAEV,GAAG,CAAC,EAAE;;;;OAIhB,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { Column } from '../Table/types';\nimport { Data } from './types';\nimport { Table } from '../Table/Table';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\n\nexport class SubscriptionsTable extends TranslatableMixin(Table, 'subscriptions-table')<Data> {\n static priceColumn: Column<Data> = {\n cell: ctx => {\n const cart = ctx.data._embedded['fx:transaction_template'];\n const amount = `${cart.total_order} ${cart.currency_code}`;\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n frequencies\"\n class=\"font-medium text-m font-tnum\"\n lang=${ctx.lang}\n key=\"price_${ctx.data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ctx.ns}\n .options=${{ ...parseFrequency(ctx.data.frequency), amount }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static summaryColumn: Column<Data> = {\n cell: ctx => {\n const items = ctx.data._embedded['fx:transaction_template']._embedded['fx: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 return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n summaries\"\n class=\"text-m\"\n lang=${ctx.lang}\n key=\"transaction_summary\"\n ns=${ctx.ns}\n .options=${options}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static statusColumn: Column<Data> = {\n hideBelow: 'sm',\n cell: ({ ns, lang, data, html }) => {\n let color = 'bg-contrast-5 text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'bg-error-10 text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(data.end_date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else if (!data.is_active) {\n date = '';\n key = 'subscription_inactive';\n } else if (new Date(data.start_date) > new Date()) {\n date = data.start_date;\n key = 'subscription_will_be_active';\n } else {\n color = 'bg-success-10 text-success';\n date = data.next_transaction_date;\n key = 'subscription_active';\n }\n\n return html`\n <foxy-i18n\n data-testclass=\"i18n statuses\"\n class=\"px-s py-xs text-m font-medium block whitespace-normal rounded ${color}\"\n lang=${lang}\n key=${key}\n ns=${ns}\n .options=${{ date }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static subTokenURLColumn: Column<Data> = {\n cell: ctx => {\n return ctx.html`\n <a\n data-testclass=\"links\"\n target=\"_blank\"\n class=\"text-m font-medium text-primary rounded hover-underline focus-outline-none focus-shadow-outline\"\n href=${ctx.data._links['fx:sub_token_url'].href}\n >\n <foxy-i18n\n data-testclass=\"i18n\"\n lang=${ctx.lang}\n key=\"update\"\n ns=${ctx.ns}\n >\n </foxy-i18n>\n </a>\n `;\n },\n };\n\n columns = [\n SubscriptionsTable.priceColumn,\n SubscriptionsTable.summaryColumn,\n SubscriptionsTable.statusColumn,\n SubscriptionsTable.subTokenURLColumn,\n ];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import{_ as t}from"./shared-4c2e9064.js";import{T as e}from"./shared-7a455b15.js";import{a as s}from"./shared-3b709ddc.js";import{p as a}from"./shared-630a0ff2.js";let n,o,r,i,c=t=>t;class l extends(s(e,"subscriptions-table")){constructor(){super(...arguments),this.columns=[l.priceColumn,l.summaryColumn,l.statusColumn,l.subTokenURLColumn]}}l.priceColumn={cell:e=>{const s=e.data._embedded["fx:transaction_template"],o=`${s.total_order} ${s.currency_code}`;return e.html(n||(n=c`
|
|
2
|
-
<foxy-i18n
|
|
3
|
-
data-testclass="i18n frequencies"
|
|
4
|
-
class="font-medium text-m font-tnum"
|
|
5
|
-
lang=${0}
|
|
6
|
-
key="price_${0}"
|
|
7
|
-
ns=${0}
|
|
8
|
-
.options=${0}
|
|
9
|
-
>
|
|
10
|
-
</foxy-i18n>
|
|
11
|
-
`),e.lang,".5m"===e.data.frequency?"twice_a_month":"recurring",e.ns,t(t({},a(e.data.frequency)),{},{amount:o}))}},l.summaryColumn={cell:t=>{const e=t.data._embedded["fx:transaction_template"]._embedded["fx:items"],s={most_expensive_item:[...e].sort(((t,e)=>t.price-e.price))[0],count_minus_one:e.length-1,count:e.length};return t.html(o||(o=c`
|
|
12
|
-
<foxy-i18n
|
|
13
|
-
data-testclass="i18n summaries"
|
|
14
|
-
class="text-m"
|
|
15
|
-
lang=${0}
|
|
16
|
-
key="transaction_summary"
|
|
17
|
-
ns=${0}
|
|
18
|
-
.options=${0}
|
|
19
|
-
>
|
|
20
|
-
</foxy-i18n>
|
|
21
|
-
`),t.lang,t.ns,s)}},l.statusColumn={hideBelow:"sm",cell:t=>{let e,s,a;if(t.data.first_failed_transaction_date)s=t.data.first_failed_transaction_date,a="subscription_failed",e="bg-error-10 text-error";else if(t.data.end_date){s=t.data.end_date;const n=new Date(s).getTime()>Date.now();a=n?"subscription_will_be_cancelled":"subscription_cancelled",e=n?"bg-success-10 text-success":"bg-contrast-5 text-tertiary"}else s=t.data.next_transaction_date,t.data.is_active?(a="subscription_active",e="bg-success-10 text-success"):(a="subscription_inactive",e="bg-contrast-5 text-tertiary");return t.html(r||(r=c`
|
|
22
|
-
<foxy-i18n
|
|
23
|
-
data-testclass="i18n statuses"
|
|
24
|
-
class="px-s py-xs text-m font-medium block whitespace-normal rounded ${0}"
|
|
25
|
-
lang=${0}
|
|
26
|
-
key=${0}
|
|
27
|
-
ns=${0}
|
|
28
|
-
.options=${0}
|
|
29
|
-
>
|
|
30
|
-
</foxy-i18n>
|
|
31
|
-
`),e,t.lang,a,t.ns,{date:s})}},l.subTokenURLColumn={cell:t=>t.html(i||(i=c`
|
|
32
|
-
<a
|
|
33
|
-
data-testclass="links"
|
|
34
|
-
target="_blank"
|
|
35
|
-
class="text-m font-medium text-primary rounded hover-underline focus-outline-none focus-shadow-outline"
|
|
36
|
-
href=${0}
|
|
37
|
-
>
|
|
38
|
-
<foxy-i18n
|
|
39
|
-
data-testclass="i18n"
|
|
40
|
-
lang=${0}
|
|
41
|
-
key="update"
|
|
42
|
-
ns=${0}
|
|
43
|
-
>
|
|
44
|
-
</foxy-i18n>
|
|
45
|
-
</a>
|
|
46
|
-
`),t.data._links["fx:sub_token_url"].href,t.lang,t.ns)};export{l as S};
|