@foxy.io/elements 1.39.0-beta.3 → 1.39.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 (55) hide show
  1. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-cancellation-form.js +1 -1
  4. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  5. package/dist/cdn/foxy-customer-portal.js +6 -10
  6. package/dist/cdn/foxy-customer.js +1 -1
  7. package/dist/cdn/foxy-donation.js +1 -1
  8. package/dist/cdn/foxy-error-entry-card.js +1 -1
  9. package/dist/cdn/foxy-item-card.js +1 -1
  10. package/dist/cdn/foxy-report-form.js +1 -1
  11. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  12. package/dist/cdn/foxy-subscription-card.js +1 -1
  13. package/dist/cdn/foxy-subscription-form.js +1 -1
  14. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  15. package/dist/cdn/{shared-56d70cc2.js → shared-230dee11.js} +5 -5
  16. package/dist/cdn/shared-84eb85dd.js +1 -0
  17. package/dist/cdn/shared-ada5e9f5.js +1 -0
  18. package/dist/cdn/translations/customer/en.json +18 -10
  19. package/dist/cdn/translations/customer-portal/de.json +33 -13
  20. package/dist/cdn/translations/customer-portal/en.json +24 -8
  21. package/dist/cdn/translations/customer-portal/es.json +32 -12
  22. package/dist/cdn/translations/customer-portal/fr.json +33 -13
  23. package/dist/cdn/translations/customer-portal/nl.json +33 -13
  24. package/dist/cdn/translations/customer-portal/pl.json +33 -13
  25. package/dist/cdn/translations/customer-portal/sv.json +33 -13
  26. package/dist/cdn/translations/customer-portal/zh-hk.json +34 -14
  27. package/dist/cdn/translations/store-shipping-method-form/en.json +4 -3
  28. package/dist/cdn/translations/subscription-card/en.json +8 -0
  29. package/dist/cdn/translations/subscription-form/en.json +16 -8
  30. package/dist/elements/private/Group/Group.js +2 -2
  31. package/dist/elements/private/Group/Group.js.map +1 -1
  32. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js +2 -2
  33. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js.map +1 -1
  34. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +3 -6
  35. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  36. package/dist/elements/public/ItemCard/ItemCard.d.ts +3 -1
  37. package/dist/elements/public/ItemCard/ItemCard.js +20 -9
  38. package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
  39. package/dist/elements/public/ItemCard/types.d.ts +4 -2
  40. package/dist/elements/public/ItemCard/types.js.map +1 -1
  41. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +25 -4
  42. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  43. package/dist/elements/public/SubscriptionCard/SubscriptionCard.d.ts +4 -1
  44. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +19 -6
  45. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  46. package/dist/elements/public/SubscriptionCard/types.d.ts +4 -2
  47. package/dist/elements/public/SubscriptionCard/types.js.map +1 -1
  48. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +20 -7
  49. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  50. package/dist/utils/get-subscription-status.d.ts +3 -1
  51. package/dist/utils/get-subscription-status.js +27 -0
  52. package/dist/utils/get-subscription-status.js.map +1 -1
  53. package/package.json +2 -2
  54. package/dist/cdn/shared-4f64c35e.js +0 -1
  55. package/dist/cdn/shared-e2675ed0.js +0 -1
@@ -919,14 +919,24 @@
919
919
  "frequency": "$t(customer.subscription-card.{{units}}, { \"count\": {{count}}, \"ns\": \"customer-portal\" })",
920
920
  "monthly": "/ 月",
921
921
  "monthly_plural": "/ {{count}} 几个月",
922
+ "price": "{{amount, price}}",
922
923
  "price_recurring": "{{amount, price}} $t(customer.subscription-card.frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"customer-portal\" })",
923
924
  "price_twice_a_month": "{{amount, price}} $t(customer.subscription-card.twice_a_month, { \"ns\": \"customer-portal\" })",
924
- "subscription_active": "下次付款日期 {{date, date}}",
925
- "subscription_cancelled": "结束于 {{date, date}}",
926
- "subscription_failed": "付款失败于 {{date, date}}",
927
- "subscription_inactive": "不活跃",
928
- "subscription_will_be_cancelled": "结束于 {{date, date}}",
929
- "subscription_will_be_active": "开始于 {{date, date}}",
925
+ "status_failed_and_ended": " {{ end_date, date }} 结束(于 {{ first_failed_transaction_date, date }} 失败)",
926
+ "status_failed_and_ended_no_enddate": "已结束(于 {{ first_failed_transaction_date, date }} 失败)",
927
+ "status_failed": " {{ first_failed_transaction_date, date }} 失败",
928
+ "status_will_start": "于 {{ start_date, date }} 开始",
929
+ "status_will_start_no_startdate": "计划开始",
930
+ "status_will_end_after_payment": "下次付款日期为 {{ next_transaction_date, date }},结束于 {{ end_date, date }}",
931
+ "status_will_end_after_payment_no_nextdate": "活跃,结束于 {{ end_date, date }}",
932
+ "status_will_end_after_payment_no_enddate": "下次付款日期为 {{ next_transaction_date, date }}",
933
+ "status_will_end": "于 {{ end_date, date }} 结束",
934
+ "status_will_end_no_enddate": "活跃,计划结束",
935
+ "status_ended": "于 {{ end_date, date }} 结束",
936
+ "status_ended_no_enddate": "已结束",
937
+ "status_next_payment": "下次付款日期为 {{ next_transaction_date, date }}",
938
+ "status_next_payment_no_nextdate": "活跃",
939
+ "status_inactive": "不活跃",
930
940
  "transaction_summary": "{{most_expensive_item.name}}",
931
941
  "fees_hint": "公司",
932
942
  "fees_explainer": "税费、运费和折扣可能会改变收费金额。",
@@ -944,16 +954,26 @@
944
954
  },
945
955
  "subscription-form": {
946
956
  "header": {
947
- "title_new": "訂閱",
948
- "title_existing": "訂閱",
957
+ "title_new": "订阅",
958
+ "title_existing": "订阅 • {{amount, price}}",
949
959
  "title_recurring": "{{amount, price}} $t(customer.subscription-form.frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"customer-portal\" })",
950
960
  "title_twice_a_month": "{{amount, price}} $t(customer.subscription-form.twice_a_month, { \"ns\": \"customer-portal\" })",
951
- "subtitle_active": "包括運費、稅金等。下次付款日期 {{date, date}}",
952
- "subtitle_cancelled": "包括運費、稅金等。結束於 {{date, date}}",
953
- "subtitle_failed": "包括運費、稅金等。付款失敗於 {{date, date}}",
954
- "subtitle_inactive": "包括運費、稅金等。不活躍。",
955
- "subtitle_will_be_cancelled": "包括運費、稅金等。結束於 {{date, date}}。",
956
- "subtitle_will_be_active": "包括運費、稅金等。開始於 {{date, date}}。",
961
+ "subtitle_failed_and_ended": "包括运费、税费等。于 {{ end_date, date }} 结束(于 {{ first_failed_transaction_date, date }} 失败)。",
962
+ "subtitle_failed_and_ended_no_enddate": "包括运费、税费等。已结束(于 {{ first_failed_transaction_date, date }} 失败)。",
963
+ "subtitle_failed": "包括运费、税费等。于 {{ first_failed_transaction_date, date }} 失败。",
964
+ "subtitle_will_start": "包括运费、税费等。于 {{ start_date, date }} 开始。",
965
+ "subtitle_will_start_no_startdate": "包括运费、税费等。计划开始。",
966
+ "subtitle_will_end_after_payment": "包括运费、税费等。下次付款日期为 {{ next_transaction_date, date }},结束于 {{ end_date, date }}。",
967
+ "subtitle_will_end_after_payment_no_nextdate": "包括运费、税费等。活跃,结束于 {{ end_date, date }}。",
968
+ "subtitle_will_end_after_payment_no_enddate": "包括运费、税费等。下次付款日期为 {{ next_transaction_date, date }}。",
969
+ "subtitle_will_end": "包括运费、税费等。于 {{ end_date, date }} 结束。",
970
+ "subtitle_will_end_no_enddate": "包括运费、税费等。活跃,计划结束。",
971
+ "subtitle_ended": "包括运费、税费等。于 {{ end_date, date }} 结束。",
972
+ "subtitle_ended_no_enddate": "包括运费、税费等。已结束。",
973
+ "subtitle_next_payment": "包括运费、税费等。下次付款日期为 {{ next_transaction_date, date }}。",
974
+ "subtitle_next_payment_no_nextdate": "包括运费、税费等。活跃。",
975
+ "subtitle_inactive": "包括运费、税费等。不活跃。",
976
+ "subtitle": "包括运费、税费等。",
957
977
  "copy-id": {
958
978
  "failed_to_copy": "複製失敗",
959
979
  "click_to_copy": "複製 ID",
@@ -160,8 +160,9 @@
160
160
  "account": {
161
161
  "label": "Account",
162
162
  "helper_text": "",
163
+ "ups_use_legacy_admin_message": "Connecting to a UPS account is currently restricted from this admin. Please utilise the Integrations page in our legacy administration to connect to your UPS account.",
163
164
  "use-custom-account": {
164
- "label": "Use custom credentials",
165
+ "label": "Use my own account",
165
166
  "helper_text": "",
166
167
  "checked": "Yes",
167
168
  "unchecked": "No"
@@ -173,10 +174,10 @@
173
174
  "v8n_too_long": "Authentication key must be 50 characters or less."
174
175
  },
175
176
  "meter-number": {
176
- "label": "Meter Number",
177
+ "label": "Account Number",
177
178
  "placeholder": "N/A",
178
179
  "helper_text": "",
179
- "v8n_too_long": "Meter number must be 50 characters or less."
180
+ "v8n_too_long": "Account number must be 50 characters or less."
180
181
  },
181
182
  "accountid": {
182
183
  "label": "Account ID",
@@ -4,15 +4,23 @@
4
4
  "frequency": "$t({{units}}, { \"count\": {{count}}, \"ns\": \"subscription-card\" })",
5
5
  "monthly": "Monthly",
6
6
  "monthly_plural": "Every {{count}} months",
7
+ "price": "{{amount, price}}",
7
8
  "price_recurring": "{{amount, price}} $t(frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"subscription-card\" })",
8
9
  "price_twice_a_month": "{{amount, price}} $t(twice_a_month, { \"ns\": \"subscription-card\" })",
9
10
  "status_failed_and_ended": "Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
11
+ "status_failed_and_ended_no_enddate": "Ended (failed on {{ first_failed_transaction_date, date }})",
10
12
  "status_failed": "Failed on {{ first_failed_transaction_date, date }}",
11
13
  "status_will_start": "Starts on {{ start_date, date }}",
14
+ "status_will_start_no_startdate": "Scheduled to start",
12
15
  "status_will_end_after_payment": "Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
16
+ "status_will_end_after_payment_no_nextdate": "Active, ending {{ end_date, date }}",
17
+ "status_will_end_after_payment_no_enddate": "Next payment on {{ next_transaction_date, date }}",
13
18
  "status_will_end": "Ends on {{ end_date, date }}",
19
+ "status_will_end_no_enddate": "Active, scheduled to end",
14
20
  "status_ended": "Ended on {{ end_date, date }}",
21
+ "status_ended_no_enddate": "Ended",
15
22
  "status_next_payment": "Next payment on {{ next_transaction_date, date }}",
23
+ "status_next_payment_no_nextdate": "Active",
16
24
  "status_inactive": "Inactive",
17
25
  "transaction_summary": "{{most_expensive_item.name}}",
18
26
  "fees_hint": "inc. shipping, taxes, etc.",
@@ -1,16 +1,24 @@
1
1
  {
2
2
  "header": {
3
3
  "title_new": "Subscription",
4
- "title_existing": "Subscription",
4
+ "title_existing": "Subscription • {{amount, price}}",
5
5
  "title_recurring": "{{amount, price}} $t(frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"subscription-form\" })",
6
6
  "title_twice_a_month": "{{amount, price}} $t(twice_a_month, { \"ns\": \"subscription-form\" })",
7
- "subtitle_failed_and_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
8
- "subtitle_failed": "Including shipping, taxes, etc. Failed on {{ first_failed_transaction_date, date }}",
9
- "subtitle_will_start": "Including shipping, taxes, etc. Starts on {{ start_date, date }}",
10
- "subtitle_will_end_after_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
11
- "subtitle_will_end": "Including shipping, taxes, etc. Ends on {{ end_date, date }}",
12
- "subtitle_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }}",
13
- "subtitle_next_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}",
7
+ "subtitle_failed_and_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }}).",
8
+ "subtitle_failed_and_ended_no_enddate": "Including shipping, taxes, etc. Ended (failed on {{ first_failed_transaction_date, date }}).",
9
+ "subtitle_failed": "Including shipping, taxes, etc. Failed on {{ first_failed_transaction_date, date }}.",
10
+ "subtitle_will_start": "Including shipping, taxes, etc. Starts on {{ start_date, date }}.",
11
+ "subtitle_will_start_no_startdate": "Including shipping, taxes, etc. Scheduled to start.",
12
+ "subtitle_will_end_after_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}.",
13
+ "subtitle_will_end_after_payment_no_nextdate": "Including shipping, taxes, etc. Active, ending {{ end_date, date }}.",
14
+ "subtitle_will_end_after_payment_no_enddate": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}.",
15
+ "subtitle_will_end": "Including shipping, taxes, etc. Ends on {{ end_date, date }}.",
16
+ "subtitle_will_end_no_enddate": "Including shipping, taxes, etc. Active, scheduled to end.",
17
+ "subtitle_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }}.",
18
+ "subtitle_ended_no_enddate": "Including shipping, taxes, etc. Ended.",
19
+ "subtitle_next_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}.",
20
+ "subtitle_next_payment_no_nextdate": "Including shipping, taxes, etc. Active.",
21
+ "subtitle_inactive": "Including shipping, taxes, etc. Inactive.",
14
22
  "subtitle": "Including shipping, taxes, etc.",
15
23
  "copy-id": {
16
24
  "failed_to_copy": "Failed to copy",
@@ -16,10 +16,10 @@ export class Group extends LitElement {
16
16
  return Themeable.styles;
17
17
  }
18
18
  render() {
19
- const frameClass = 'border border-contrast-10 overflow-hidden';
19
+ const frameClass = 'bg-contrast-5 overflow-hidden';
20
20
  return html `
21
21
  <section class="space-y-s font-lumo antialiased">
22
- <h3 class=${`text-s font-medium text-secondary leading-none ${this.frame ? '' : 'pl-m'}`}>
22
+ <h3 class=${`text-l font-medium text-body leading-none ${this.frame ? '' : 'pl-m'}`}>
23
23
  <slot name="header"></slot>
24
24
  </h3>
25
25
 
@@ -1 +1 @@
1
- {"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/elements/private/Group/Group.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAGV,IAAI,GACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,qCAAkC;AAEtD,kDAAkD;AAClD,MAAM,OAAO,KAAM,SAAQ,UAAU;IAArC;;QAYS,UAAK,GAAG,KAAK,CAAC;IAiBvB,CAAC;IA5BQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACzB,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,MAAM;QACtB,OAAO,SAAS,CAAC,MAAM,CAAC;IAC1B,CAAC;IAIM,MAAM;QACX,MAAM,UAAU,GAAG,2CAA2C,CAAC;QAE/D,OAAO,IAAI,CAAA;;oBAEK,kDAAkD,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;;;;8BAIlE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;;;KAIrD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import {\n CSSResult,\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n html,\n} from 'lit-element';\n\nimport { Themeable } from '../../../mixins/themeable';\n\n/** @deprecated – use internal controls instead */\nexport class Group extends LitElement {\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n frame: { type: Boolean },\n };\n }\n\n public static get styles(): CSSResult | CSSResultArray {\n return Themeable.styles;\n }\n\n public frame = false;\n\n public render(): TemplateResult {\n const frameClass = 'border border-contrast-10 overflow-hidden';\n\n return html`\n <section class=\"space-y-s font-lumo antialiased\">\n <h3 class=${`text-s font-medium text-secondary leading-none ${this.frame ? '' : 'pl-m'}`}>\n <slot name=\"header\"></slot>\n </h3>\n\n <div class=\"rounded ${this.frame ? frameClass : ''}\">\n <slot></slot>\n </div>\n </section>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Group.js","sourceRoot":"","sources":["../../../../src/elements/private/Group/Group.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAGV,IAAI,GACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,qCAAkC;AAEtD,kDAAkD;AAClD,MAAM,OAAO,KAAM,SAAQ,UAAU;IAArC;;QAYS,UAAK,GAAG,KAAK,CAAC;IAiBvB,CAAC;IA5BQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACzB,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,MAAM;QACtB,OAAO,SAAS,CAAC,MAAM,CAAC;IAC1B,CAAC;IAIM,MAAM;QACX,MAAM,UAAU,GAAG,+BAA+B,CAAC;QAEnD,OAAO,IAAI,CAAA;;oBAEK,6CAA6C,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;;;;8BAI7D,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;;;;KAIrD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import {\n CSSResult,\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n html,\n} from 'lit-element';\n\nimport { Themeable } from '../../../mixins/themeable';\n\n/** @deprecated – use internal controls instead */\nexport class Group extends LitElement {\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n frame: { type: Boolean },\n };\n }\n\n public static get styles(): CSSResult | CSSResultArray {\n return Themeable.styles;\n }\n\n public frame = false;\n\n public render(): TemplateResult {\n const frameClass = 'bg-contrast-5 overflow-hidden';\n\n return html`\n <section class=\"space-y-s font-lumo antialiased\">\n <h3 class=${`text-l font-medium text-body leading-none ${this.frame ? '' : 'pl-m'}`}>\n <slot name=\"header\"></slot>\n </h3>\n\n <div class=\"rounded ${this.frame ? frameClass : ''}\">\n <slot></slot>\n </div>\n </section>\n `;\n }\n}\n"]}
@@ -18,8 +18,8 @@ export class InternalCustomerPortalLink extends ThemeableMixin(LitElement) {
18
18
  }
19
19
  render() {
20
20
  const actionClass = classMap({
21
- 'flex-auto font-medium tracking-wide text-s rounded-s transition-colors': true,
22
- 'hover-text-primary hover-cursor-pointer': !this.disabled,
21
+ 'flex-auto leading-m font-medium tracking-wide text-m rounded-s transition-colors': true,
22
+ 'text-primary hover-underline hover-cursor-pointer': !this.disabled,
23
23
  'focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2': !this.disabled,
24
24
  'text-disabled cursor-default': this.disabled,
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"InternalCustomerPortalLink.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,OAAO,0BAA2B,SAAQ,cAAc,CAAC,UAAU,CAAC;IAA1E;;QAUE,aAAQ,GAAG,KAAK,CAAC;QAEjB,SAAI,GAAG,EAAE,CAAC;QAEV,SAAI,GAAG,EAAE,CAAC;IAuBZ,CAAC;IApCC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;YAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACtB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACvB,CAAC;IACJ,CAAC;IAQD,MAAM;QACJ,MAAM,WAAW,GAAG,QAAQ,CAAC;YAC3B,wEAAwE,EAAE,IAAI;YAC9E,yCAAyC,EAAE,CAAC,IAAI,CAAC,QAAQ;YACzD,+DAA+D,EAAE,CAAC,IAAI,CAAC,QAAQ;YAC/E,8BAA8B,EAAE,IAAI,CAAC,QAAQ;SAC9C,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,mBAAmB,IAAI,CAAC,IAAI,mCAAmC,CAAC,CAAC,CAAC,EAAE;;KAEvF,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAA,iBAAiB,WAAW,aAAa,aAAa,WAAW,CAAC;SAC9E;QAED,OAAO,IAAI,CAAA;iBACE,WAAW,SAAS,IAAI,CAAC,IAAI,4BAA4B,aAAa;KAClF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { classMap } from '../../../utils/class-map';\n\nexport class InternalCustomerPortalLink extends ThemeableMixin(LitElement) {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n disabled: { type: Boolean },\n href: { type: String },\n icon: { type: String },\n };\n }\n\n disabled = false;\n\n href = '';\n\n icon = '';\n\n render(): TemplateResult {\n const actionClass = classMap({\n 'flex-auto font-medium tracking-wide text-s rounded-s transition-colors': true,\n 'hover-text-primary hover-cursor-pointer': !this.disabled,\n 'focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2': !this.disabled,\n 'text-disabled cursor-default': this.disabled,\n });\n\n const actionContent = html`\n ${this.icon ? html`<iron-icon icon=${this.icon} class=\"icon-inline\"></iron-icon>` : ''}\n <slot></slot>\n `;\n\n if (this.disabled) {\n return html`<button class=${actionClass} disabled>${actionContent}</button>`;\n }\n\n return html`\n <a class=${actionClass} href=${this.href} rel=\"nofollow noopener\">${actionContent}</a>\n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,4BAA4B,aAAa;KAClF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { classMap } from '../../../utils/class-map';\n\nexport class InternalCustomerPortalLink extends ThemeableMixin(LitElement) {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n disabled: { type: Boolean },\n href: { type: String },\n icon: { type: String },\n };\n }\n\n disabled = false;\n\n href = '';\n\n icon = '';\n\n render(): TemplateResult {\n const actionClass = classMap({\n 'flex-auto leading-m font-medium tracking-wide text-m rounded-s transition-colors': true,\n 'text-primary hover-underline hover-cursor-pointer': !this.disabled,\n 'focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2': !this.disabled,\n 'text-disabled cursor-default': this.disabled,\n });\n\n const actionContent = html`\n ${this.icon ? html`<iron-icon icon=${this.icon} class=\"icon-inline\"></iron-icon>` : ''}\n <slot></slot>\n `;\n\n if (this.disabled) {\n return html`<button class=${actionClass} disabled>${actionContent}</button>`;\n }\n\n return html`\n <a class=${actionClass} href=${this.href} rel=\"nofollow noopener\">${actionContent}</a>\n `;\n }\n}\n"]}
@@ -30,7 +30,6 @@ export class InternalCustomerPortalSubscriptions extends Base {
30
30
  <foxy-internal-customer-portal-link
31
31
  data-testid="header:actions:update"
32
32
  href=${billingLink}
33
- icon="icons:credit-card"
34
33
  ?disabled=${hasEnded || !host.in('idle')}
35
34
  >
36
35
  <foxy-i18n lang=${host.lang} key="update_billing" ns=${host.ns}></foxy-i18n>
@@ -54,7 +53,6 @@ export class InternalCustomerPortalSubscriptions extends Base {
54
53
  <foxy-internal-customer-portal-link
55
54
  data-testid="header:actions:end"
56
55
  href=${cancelLink}
57
- icon="icons:block"
58
56
  ?disabled=${hasEndDate || !host.in('idle')}
59
57
  >
60
58
  <foxy-i18n lang=${host.lang} key="end_subscription" ns=${host.ns}></foxy-i18n>
@@ -70,10 +68,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
70
68
  <style>
71
69
  main {
72
70
  display: flex;
73
- justify-content: space-between;
74
- padding-top: var(--lumo-space-xs);
75
- margin-top: var(--lumo-space-s);
76
- border-top: 1px solid var(--lumo-contrast-10pct);
71
+ gap: var(--lumo-space-m);
77
72
  color: var(--lumo-secondary-color);
78
73
  }
79
74
  </style>
@@ -167,6 +162,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
167
162
  >
168
163
  <foxy-subscription-card
169
164
  hiddencontrols="email"
165
+ settings=${JSON.stringify(this.settings)}
170
166
  parent=${ctx.parent}
171
167
  group=${ctx.group}
172
168
  lang=${ctx.lang}
@@ -226,6 +222,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
226
222
  lang=${this.lang}
227
223
  ns=${this.ns}
228
224
  id="subscription-dialog"
225
+ alert
229
226
  .form=${this.__renderForm}
230
227
  .templates=${this.getNestedTemplates('list:form')}
231
228
  >
@@ -1 +1 @@
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,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AE,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"]}
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,I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AC,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 ?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 ?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 gap: var(--lumo-space-m);\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 settings=${JSON.stringify(this.settings)}\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 alert\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,6 +1,6 @@
1
1
  import type { PropertyDeclarations } from 'lit-element';
2
2
  import type { TemplateResult } from 'lit-html';
3
- import type { Data } from './types';
3
+ import type { Data, Settings } from './types';
4
4
  import { InternalCard } from '../../internal/InternalCard/InternalCard';
5
5
  declare const Base: typeof InternalCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
6
6
  defaultNS: string;
@@ -14,6 +14,7 @@ declare const Base: typeof InternalCard & import("lit-element").Constructor<impo
14
14
  export declare class ItemCard extends Base<Data> {
15
15
  static get properties(): PropertyDeclarations;
16
16
  localeCodes: string | null;
17
+ settings: Settings | null;
17
18
  private static readonly __placeholder;
18
19
  private readonly __transactionTemplateLoaderId;
19
20
  private readonly __defaultTemplateSetLoaderId;
@@ -42,5 +43,6 @@ export declare class ItemCard extends Base<Data> {
42
43
  private get __currencyCode();
43
44
  private get __subinfoOptions();
44
45
  private get __subinfoKey();
46
+ private get __filteredOptions();
45
47
  }
46
48
  export {};
@@ -17,6 +17,7 @@ export class ItemCard extends Base {
17
17
  constructor() {
18
18
  super(...arguments);
19
19
  this.localeCodes = null;
20
+ this.settings = null;
20
21
  this.__transactionTemplateLoaderId = 'transactionTemplateLoader';
21
22
  this.__defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';
22
23
  this.__localeCodesHelperLoaderId = 'localeCodesLoader';
@@ -29,13 +30,17 @@ export class ItemCard extends Base {
29
30
  return {
30
31
  ...super.properties,
31
32
  localeCodes: { type: String, attribute: 'locale-codes' },
33
+ settings: { type: Object },
32
34
  };
33
35
  }
34
36
  renderBody() {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
36
- const quantity = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.quantity) !== null && _b !== void 0 ? _b : 0;
37
- const options = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._embedded) === null || _d === void 0 ? void 0 : _d['fx:item_options'];
38
- const price = (_f = (_e = this.data) === null || _e === void 0 ? void 0 : _e.price) !== null && _f !== void 0 ? _f : 0;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
38
+ const displayConfig = (_a = this.settings) === null || _a === void 0 ? void 0 : _a.cart_display_config;
39
+ const quantity = (_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b.quantity) !== null && _c !== void 0 ? _c : 0;
40
+ const options = this.__filteredOptions;
41
+ const price = (_e = (_d = this.data) === null || _d === void 0 ? void 0 : _d.price) !== null && _e !== void 0 ? _e : 0;
42
+ const code = (_g = (_f = this.data) === null || _f === void 0 ? void 0 : _f.code) !== null && _g !== void 0 ? _g : '';
43
+ const displayedCode = displayConfig ? (displayConfig.show_product_code ? code : '') : code;
39
44
  const currencyDisplay = this.__currencyDisplay;
40
45
  const currencyCode = this.__currencyCode;
41
46
  return html `
@@ -108,7 +113,7 @@ export class ItemCard extends Base {
108
113
  >
109
114
  <img
110
115
  class="relative h-s w-s object-cover rounded-s bg-contrast-20 flex-shrink-0 shadow-xs"
111
- src=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g.image)}
116
+ src=${ifDefined((_h = this.data) === null || _h === void 0 ? void 0 : _h.image)}
112
117
  alt=""
113
118
  @error=${(evt) => {
114
119
  const img = evt.currentTarget;
@@ -121,7 +126,7 @@ export class ItemCard extends Base {
121
126
  <div class="min-w-0 flex-1 leading-s">
122
127
  <div class="flex items-center justify-between">
123
128
  <div class="truncate text-m font-medium">
124
- ${decode((_h = this.data) === null || _h === void 0 ? void 0 : _h.name) || html `<foxy-i18n infer="" key="no_code"></foxy-i18n>`}
129
+ ${decode((_j = this.data) === null || _j === void 0 ? void 0 : _j.name) || html `<foxy-i18n infer="" key="no_code"></foxy-i18n>`}
125
130
  </div>
126
131
  <span class="text-s text-tertiary whitespace-nowrap">
127
132
  ${quantity} &times;
@@ -135,11 +140,11 @@ export class ItemCard extends Base {
135
140
  </div>
136
141
 
137
142
  <div class="truncate text-secondary text-s">
138
- ${((_j = this.data) === null || _j === void 0 ? void 0 : _j.code) || undefined}
139
- ${((_k = this.data) === null || _k === void 0 ? void 0 : _k.subscription_frequency) &&
143
+ ${displayedCode}
144
+ ${((_k = displayConfig === null || displayConfig === void 0 ? void 0 : displayConfig.show_sub_frequency) !== null && _k !== void 0 ? _k : true) && ((_l = this.data) === null || _l === void 0 ? void 0 : _l.subscription_frequency) &&
140
145
  !this.hiddenSelector.matches('autorenew-icon', true)
141
146
  ? html `
142
- <span> &bull; </span>
147
+ ${displayedCode ? html `<span> &bull; </span>` : ''}
143
148
  <foxy-i18n
144
149
  infer=""
145
150
  key=${this.__subinfoKey}
@@ -340,6 +345,12 @@ export class ItemCard extends Base {
340
345
  if (frequency)
341
346
  return `subinfo_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;
342
347
  }
348
+ get __filteredOptions() {
349
+ var _a, _b, _c, _d, _e;
350
+ const allOptions = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._embedded) === null || _b === void 0 ? void 0 : _b['fx:item_options'];
351
+ const hiddenOptions = (_e = (_d = (_c = this.settings) === null || _c === void 0 ? void 0 : _c.cart_display_config) === null || _d === void 0 ? void 0 : _d.hidden_product_options) !== null && _e !== void 0 ? _e : [];
352
+ return allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(option => !hiddenOptions.includes(option.name));
353
+ }
343
354
  }
344
355
  ItemCard.__placeholder = 'data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';
345
356
  //# sourceMappingURL=ItemCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ItemCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/ItemCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,WAAW,CAAC;AACvB,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,OAAO,Q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,0CAAG,CAAC,EAAE;aACtE;SACF;IACH,CAAC;IAED,IAAY,gBAAgB;;QAC1B,MAAM,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC/C,IAAI,eAAe,KAAK,SAAS;YAAE,OAAO;QAE1C,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,IAAI,YAAY,KAAK,SAAS;YAAE,OAAO;QAEvC,MAAM,UAAU,SAAG,IAAI,CAAC,qBAAqB,0CAAE,WAAW,CAAC;QAC3D,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO;QAErC,MAAM,SAAS,SAAG,IAAI,CAAC,IAAI,0CAAE,sBAAsB,CAAC;QACpD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QAEpC,MAAM,SAAS,SAAG,IAAI,CAAC,IAAI,0CAAE,uBAAuB,CAAC;QACrD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QAEpC,OAAO;YACL,GAAG,cAAc,CAAC,SAAS,CAAC;YAC5B,MAAM,EAAE,GAAG,UAAU,IAAI,YAAY,EAAE;YACvC,eAAe;YACf,SAAS;SACV,CAAC;IACJ,CAAC;IAED,IAAY,YAAY;;QACtB,MAAM,SAAS,SAAG,IAAI,CAAC,IAAI,0CAAE,sBAAsB,CAAC;QACpD,IAAI,SAAS;YAAE,OAAO,WAAW,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACzF,CAAC;;AA3UuB,sBAAa,GACnC,+wDAA+wD,CAAC","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 { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { decode } from 'html-entities';\nimport { html } from 'lit-html';\n\nconst NS = 'item-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Basic card displaying an item.\n *\n * @element foxy-item-card\n * @since 1.17.0\n */\nexport class ItemCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { type: String, attribute: 'locale-codes' },\n };\n }\n\n localeCodes: string | null = null;\n\n private static readonly __placeholder =\n 'data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E';\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __cartLoaderId = 'cartLoader';\n\n renderBody(): TemplateResult {\n const quantity = this.data?.quantity ?? 0;\n const options = this.data?._embedded?.['fx:item_options'];\n const price = this.data?.price ?? 0;\n\n const currencyDisplay = this.__currencyDisplay;\n const currencyCode = this.__currencyCode;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionHref)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__cartHref)}\n id=${this.__cartLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div\n class=\"flex items-start leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-s bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${ifDefined(this.data?.image)}\n alt=\"\"\n @error=${(evt: Event) => {\n const img = evt.currentTarget as HTMLImageElement;\n img.src = ItemCard.__placeholder;\n }}\n />\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"h-s flex items-center\">\n <div class=\"min-w-0 flex-1 leading-s\">\n <div class=\"flex items-center justify-between\">\n <div class=\"truncate text-m font-medium\">\n ${decode(this.data?.name) || html`<foxy-i18n infer=\"\" key=\"no_code\"></foxy-i18n>`}\n </div>\n <span class=\"text-s text-tertiary whitespace-nowrap\">\n ${quantity} &times;\n <foxy-i18n\n .options=${{ amount: `${price} ${currencyCode}`, currencyDisplay }}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </span>\n </div>\n\n <div class=\"truncate text-secondary text-s\">\n ${this.data?.code || undefined}\n ${this.data?.subscription_frequency &&\n !this.hiddenSelector.matches('autorenew-icon', true)\n ? html`\n <span> &bull; </span>\n <foxy-i18n\n infer=\"\"\n key=${this.__subinfoKey}\n .options=${this.__subinfoOptions}\n >\n </foxy-i18n>\n `\n : ''}\n &ZeroWidthSpace;\n </div>\n </div>\n </div>\n\n ${options && options.length > 0\n ? html`\n <div class=\"mt-m\">\n ${options.map(\n option => html`\n <div data-testclass=\"option\" class=\"flex items-center gap-s text-s leading-s\">\n <div class=\"truncate text-secondary\">\n ${option.name}: <span class=\"font-medium text-body\">${option.value}</span>\n </div>\n\n ${option.price_mod\n ? html`\n <div class=\"border-t border-dashed border-contrast-10 flex-1\"></div>\n <div class=\"whitespace-nowrap text-tertiary\">\n <foxy-i18n\n options=${JSON.stringify({\n amount: `${option.price_mod} ${currencyCode}`,\n signDisplay: 'exceptZero',\n currencyDisplay: currencyDisplay,\n })}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n const isLoaded = !!this.__currencyDisplay && !!this.__currencyCode;\n return super.isBodyReady && isLoaded;\n }\n\n private get __transactionTemplateHref() {\n try {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n const url = new URL(links?.['fx:subscription']?.href ?? '');\n url.searchParams.set('zoom', 'transaction_template');\n return url.toString();\n } catch {\n //\n }\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = (this.__cart ?? this.__transactionTemplate)?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __transactionHref() {\n return this.data?._links['fx:transaction']?.href;\n }\n\n private get __templateSetHref() {\n const cart = this.__cart ?? this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __cartHref() {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n return links?.['fx:cart']?.href;\n }\n\n private get __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.Subscription, { zoom: 'transaction_template' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:transaction_template'] ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __transaction() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n const selector = `#${this.__transactionLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __cart() {\n type Loader = NucleonElement<Resource<Rels.Cart>>;\n const selector = `#${this.__cartLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n if (this.data && !this.data._links['fx:store']) return 'symbol';\n }\n\n private get __currencyCode() {\n const transaction = this.__transaction;\n\n if (transaction) {\n return transaction.currency_code;\n } else {\n const cart = this.__cart ?? this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n }\n\n private get __subinfoOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.subscription_frequency;\n if (frequency === undefined) return;\n\n const startDate = this.data?.subscription_start_date;\n if (startDate === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n startDate,\n };\n }\n\n private get __subinfoKey() {\n const frequency = this.data?.subscription_frequency;\n if (frequency) return `subinfo_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n}\n"]}
1
+ {"version":3,"file":"ItemCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/ItemCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,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AAI,CAAC,IAAI,0CAAE,uBAAuB,CAAC;QACrD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QAEpC,OAAO;YACL,GAAG,cAAc,CAAC,SAAS,CAAC;YAC5B,MAAM,EAAE,GAAG,UAAU,IAAI,YAAY,EAAE;YACvC,eAAe;YACf,SAAS;SACV,CAAC;IACJ,CAAC;IAED,IAAY,YAAY;;QACtB,MAAM,SAAS,SAAG,IAAI,CAAC,IAAI,0CAAE,sBAAsB,CAAC;QACpD,IAAI,SAAS;YAAE,OAAO,WAAW,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACzF,CAAC;IAED,IAAY,iBAAiB;;QAC3B,MAAM,UAAU,eAAG,IAAI,CAAC,IAAI,0CAAE,SAAS,0CAAG,iBAAiB,CAAC,CAAC;QAC7D,MAAM,aAAa,qBAAG,IAAI,CAAC,QAAQ,0CAAE,mBAAmB,0CAAE,sBAAsB,mCAAI,EAAE,CAAC;QACvF,OAAO,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;IAC5E,CAAC;;AArVuB,sBAAa,GACnC,+wDAA+wD,CAAC","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data, Settings } from './types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { decode } from 'html-entities';\nimport { html } from 'lit-html';\n\nconst NS = 'item-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Basic card displaying an item.\n *\n * @element foxy-item-card\n * @since 1.17.0\n */\nexport class ItemCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { type: String, attribute: 'locale-codes' },\n settings: { type: Object },\n };\n }\n\n localeCodes: string | null = null;\n\n settings: Settings | null = null;\n\n private static readonly __placeholder =\n 'data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E';\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __cartLoaderId = 'cartLoader';\n\n renderBody(): TemplateResult {\n const displayConfig = this.settings?.cart_display_config;\n const quantity = this.data?.quantity ?? 0;\n const options = this.__filteredOptions;\n const price = this.data?.price ?? 0;\n const code = this.data?.code ?? '';\n\n const displayedCode = displayConfig ? (displayConfig.show_product_code ? code : '') : code;\n const currencyDisplay = this.__currencyDisplay;\n const currencyCode = this.__currencyCode;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionHref)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__cartHref)}\n id=${this.__cartLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div\n class=\"flex items-start leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-s bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${ifDefined(this.data?.image)}\n alt=\"\"\n @error=${(evt: Event) => {\n const img = evt.currentTarget as HTMLImageElement;\n img.src = ItemCard.__placeholder;\n }}\n />\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"h-s flex items-center\">\n <div class=\"min-w-0 flex-1 leading-s\">\n <div class=\"flex items-center justify-between\">\n <div class=\"truncate text-m font-medium\">\n ${decode(this.data?.name) || html`<foxy-i18n infer=\"\" key=\"no_code\"></foxy-i18n>`}\n </div>\n <span class=\"text-s text-tertiary whitespace-nowrap\">\n ${quantity} &times;\n <foxy-i18n\n .options=${{ amount: `${price} ${currencyCode}`, currencyDisplay }}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </span>\n </div>\n\n <div class=\"truncate text-secondary text-s\">\n ${displayedCode}\n ${(displayConfig?.show_sub_frequency ?? true) &&\n this.data?.subscription_frequency &&\n !this.hiddenSelector.matches('autorenew-icon', true)\n ? html`\n ${displayedCode ? html`<span> &bull; </span>` : ''}\n <foxy-i18n\n infer=\"\"\n key=${this.__subinfoKey}\n .options=${this.__subinfoOptions}\n >\n </foxy-i18n>\n `\n : ''}\n &ZeroWidthSpace;\n </div>\n </div>\n </div>\n\n ${options && options.length > 0\n ? html`\n <div class=\"mt-m\">\n ${options.map(\n option => html`\n <div data-testclass=\"option\" class=\"flex items-center gap-s text-s leading-s\">\n <div class=\"truncate text-secondary\">\n ${option.name}: <span class=\"font-medium text-body\">${option.value}</span>\n </div>\n\n ${option.price_mod\n ? html`\n <div class=\"border-t border-dashed border-contrast-10 flex-1\"></div>\n <div class=\"whitespace-nowrap text-tertiary\">\n <foxy-i18n\n options=${JSON.stringify({\n amount: `${option.price_mod} ${currencyCode}`,\n signDisplay: 'exceptZero',\n currencyDisplay: currencyDisplay,\n })}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n const isLoaded = !!this.__currencyDisplay && !!this.__currencyCode;\n return super.isBodyReady && isLoaded;\n }\n\n private get __transactionTemplateHref() {\n try {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n const url = new URL(links?.['fx:subscription']?.href ?? '');\n url.searchParams.set('zoom', 'transaction_template');\n return url.toString();\n } catch {\n //\n }\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = (this.__cart ?? this.__transactionTemplate)?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __transactionHref() {\n return this.data?._links['fx:transaction']?.href;\n }\n\n private get __templateSetHref() {\n const cart = this.__cart ?? this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __cartHref() {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n return links?.['fx:cart']?.href;\n }\n\n private get __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.Subscription, { zoom: 'transaction_template' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:transaction_template'] ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __transaction() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n const selector = `#${this.__transactionLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __cart() {\n type Loader = NucleonElement<Resource<Rels.Cart>>;\n const selector = `#${this.__cartLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n if (this.data && !this.data._links['fx:store']) return 'symbol';\n }\n\n private get __currencyCode() {\n const transaction = this.__transaction;\n\n if (transaction) {\n return transaction.currency_code;\n } else {\n const cart = this.__cart ?? this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n }\n\n private get __subinfoOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.subscription_frequency;\n if (frequency === undefined) return;\n\n const startDate = this.data?.subscription_start_date;\n if (startDate === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n startDate,\n };\n }\n\n private get __subinfoKey() {\n const frequency = this.data?.subscription_frequency;\n if (frequency) return `subinfo_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n\n private get __filteredOptions() {\n const allOptions = this.data?._embedded?.['fx:item_options'];\n const hiddenOptions = this.settings?.cart_display_config?.hidden_product_options ?? [];\n return allOptions?.filter(option => !hiddenOptions.includes(option.name));\n }\n}\n"]}
@@ -1,5 +1,7 @@
1
- import type { Rels } from '@foxy.io/sdk/backend';
1
+ import type { Rels as CustomerRels } from '@foxy.io/sdk/customer';
2
+ import type { Rels as BackendRels } from '@foxy.io/sdk/backend';
2
3
  import type { Resource } from '@foxy.io/sdk/core';
3
- export declare type Data = Resource<Rels.Item, {
4
+ export declare type Settings = Resource<CustomerRels.CustomerPortalSettings>;
5
+ export declare type Data = Resource<BackendRels.Item, {
4
6
  zoom: 'item_options';
5
7
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels } from '@foxy.io/sdk/backend';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.Item, { zoom: 'item_options' }>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels as CustomerRels } from '@foxy.io/sdk/customer';\nimport type { Rels as BackendRels } from '@foxy.io/sdk/backend';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nexport type Settings = Resource<CustomerRels.CustomerPortalSettings>;\nexport type Data = Resource<BackendRels.Item, { zoom: 'item_options' }>;\n"]}