@foxy.io/elements 1.14.0-beta.9 → 1.14.0
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-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +18 -15
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-4ba926ca.js → shared-07abcd7b.js} +1 -1
- package/dist/cdn/{shared-ca7c3b9a.js → shared-322e60b1.js} +1 -1
- package/dist/cdn/shared-35dbd2c5.js +1 -0
- package/dist/cdn/{shared-5d94bacb.js → shared-5c8b531d.js} +1 -1
- package/dist/cdn/{shared-7007dedb.js → shared-5f54e916.js} +1 -1
- package/dist/cdn/{shared-00070cc4.js → shared-7a42073a.js} +5 -5
- package/dist/cdn/{shared-b24377bf.js → shared-8a7bee0d.js} +1 -1
- package/dist/cdn/{shared-da787055.js → shared-91e768be.js} +1 -1
- package/dist/cdn/{shared-d01035c5.js → shared-9a40309d.js} +1 -1
- package/dist/cdn/{shared-a3d2c48e.js → shared-b5147166.js} +1 -1
- package/dist/cdn/{shared-d05c93a5.js → shared-bc2bfe52.js} +1 -1
- package/dist/cdn/{shared-c5ae5d33.js → shared-ce1da35d.js} +1 -1
- package/dist/cdn/{shared-0f9809ab.js → shared-d01d809a.js} +1 -1
- package/dist/cdn/{shared-31d03530.js → shared-d8ffb279.js} +1 -1
- package/dist/cdn/{shared-daf6b763.js → shared-e5cbf291.js} +1 -1
- package/dist/cdn/{shared-007c4e34.js → shared-f1dc1c6c.js} +1 -1
- package/dist/cdn/translations/shared/de.json +94 -0
- package/dist/cdn/translations/shared/en.json +83 -83
- package/dist/cdn/translations/shared/es.json +93 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.d.ts +1 -0
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js +17 -8
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +11 -3
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
- package/dist/elements/public/ItemsForm/private/Picture.d.ts +1 -0
- package/dist/elements/public/ItemsForm/private/Picture.js +2 -0
- package/dist/elements/public/ItemsForm/private/Picture.js.map +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +12 -4
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +2 -4
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +19 -20
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +1 -3
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +21 -18
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +163 -151
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/mixins/themeable.js +10 -8
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/mixins/translatable.js +1 -1
- package/dist/mixins/translatable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-fe8a7aa2.js +0 -1
|
@@ -1,21 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
+
"add_country": "Agregar país",
|
|
3
|
+
"add_field": "Agregue campo",
|
|
2
4
|
"add_or_clause": "Añadir cláusula O",
|
|
5
|
+
"add_region": "Agregar región",
|
|
3
6
|
"add_value": "Añadir valor",
|
|
4
7
|
"address1": "Línea de dirección 1",
|
|
5
8
|
"address2": "Línea de dirección 2",
|
|
6
9
|
"address_name": "Nombre de la dirección",
|
|
7
10
|
"address_plural": "Direcciones",
|
|
11
|
+
"allowlist": "Permitir todo excepto",
|
|
8
12
|
"attribute_plural": "Atributos",
|
|
9
13
|
"back": "Volver",
|
|
10
14
|
"backend_developer": "Desarrolladora backend",
|
|
11
15
|
"backend_developer_explainer": "Administra el código del lado del servidor en PHP, Python, Ruby, etc.",
|
|
16
|
+
"billing": "Facturación",
|
|
17
|
+
"blocklist": "Prohibir todo excepto",
|
|
18
|
+
"cache": "Cache",
|
|
12
19
|
"cancel": "Cancelar",
|
|
20
|
+
"cart_controls": "Cantidad",
|
|
21
|
+
"cart_type": "Exhibición del carro",
|
|
22
|
+
"cart_type_custom": "Personalizada",
|
|
23
|
+
"cart_type_custom_explainer": "Cree su propio carrito JSONP con la configuración incluida",
|
|
24
|
+
"cart_type_default": "Sidecart",
|
|
25
|
+
"cart_type_default_explainer": "Apariencia predeterminada del carrito en la versión 2.0",
|
|
26
|
+
"cart_type_fullpage": "Full page",
|
|
27
|
+
"cart_type_fullpage_explainer": "Envíe a todos los clientes a un carrito de página completa sin dejar de incluir la funcionalidad de minicart",
|
|
28
|
+
"checked_by_default": "Comprobado de forma predeterminada",
|
|
29
|
+
"checkout_type": "Cuentas",
|
|
30
|
+
"checkout_type_account_only": "Permitir solo cuentas de clientes",
|
|
31
|
+
"checkout_type_default_account": "Permitir ambos, predeterminado para el cliente",
|
|
32
|
+
"checkout_type_default_guest": "Permitir ambos, predeterminado como invitado",
|
|
33
|
+
"checkout_type_guest_only": "Permitir solo invitados",
|
|
34
|
+
"checkout_type_helper_text": "Si selecciona $t(checkout_type_guest_only), su tienda no podrá usar suscripciones.",
|
|
13
35
|
"city": "Ciudad",
|
|
14
36
|
"client": "Cliente",
|
|
15
37
|
"close": "Cerca",
|
|
38
|
+
"close_icon": "Cerrar icono",
|
|
16
39
|
"company": "Empresa",
|
|
40
|
+
"consent": "Consentimiento",
|
|
17
41
|
"country": "País",
|
|
42
|
+
"coupon_entry": "Código promocional",
|
|
18
43
|
"create": "Crear",
|
|
44
|
+
"custom_config": "Configuración personalizada",
|
|
45
|
+
"custom_config_helper_text": "Si tiene valores personalizados que le gustaría poner a disposición de su plantilla twig, puede agregarlos aquí como una cadena JSON válida.",
|
|
46
|
+
"custom_fields": "Campos personalizados",
|
|
47
|
+
"custom_fields_helper_text": "Si tiene información que le gustaría recopilar del cliente en la página de pago, puede agregar campos de formulario personalizados aquí que se agregarán al formulario de pago. Le recomendamos que siga la misma estructura de contenedor HTML utilizada en otros campos de pago para mantener la coherencia. Puede usar la sintaxis de Twig aquí.",
|
|
48
|
+
"custom_footer": "Pie de página personalizado",
|
|
49
|
+
"custom_footer_helper_text": "Cualquier fragmento de JS o script de conversión que necesite agregar al pie de página se puede colocar aquí y se insertará antes de la etiqueta </body>. Puede usar la sintaxis de Twig aquí. Para los scripts de conversión que solo desea mostrar una vez en la página del recibo, use {% if first_receipt_display %} {# contenido del script de conversión aquí #} {% endif %}.",
|
|
50
|
+
"custom_header": "Cabecera personalizada",
|
|
51
|
+
"custom_header_helper_text": "Cualquier CSS o JS que necesite agregar al encabezado se puede colocar aquí y se insertará antes de la etiqueta </head> de sus plantillas. Tenga en cuenta que todas las referencias de archivos de secuencias de comandos deben ser a través de https o ejecutarse a través del sistema de almacenamiento en caché de Foxy. La sintaxis de Twig no está disponible en el encabezado.",
|
|
19
52
|
"customer": "Cliente",
|
|
20
53
|
"daily": "Diariamente",
|
|
21
54
|
"daily_plural": "Cada {{count}} días",
|
|
@@ -24,19 +57,36 @@
|
|
|
24
57
|
"date_modified": "Última actualización",
|
|
25
58
|
"day": "día",
|
|
26
59
|
"day_plural": "Días",
|
|
60
|
+
"default": "Defecto",
|
|
27
61
|
"default_billing_address": "Dirección de facturación",
|
|
28
62
|
"default_shipping_address": "Dirección de entrega",
|
|
29
63
|
"delete": "Eliminar",
|
|
30
64
|
"delete_prompt": "Este recurso se eliminará de forma permanente. ¿Estás seguro?",
|
|
65
|
+
"description": "Descripción",
|
|
31
66
|
"designer": "Diseñadora",
|
|
32
67
|
"designer_explainer": "Administra la apariencia, el arte y la interfaz de usuario.",
|
|
68
|
+
"disabled": "Discapacitada",
|
|
69
|
+
"display_sdta": "Mostrar un acuerdo de transferencia segura de datos a los clientes de la UE",
|
|
70
|
+
"display_sdta_explainer": "Si tiene clientes en la Unión Europea, habilite esta función para que puedan optar por enviar sus datos a nuestros servidores seguros en los Estados Unidos.",
|
|
71
|
+
"display_tos_link": "Mostrar un enlace a Términos y condiciones",
|
|
72
|
+
"display_tos_link_explainer": "Incluya una casilla de verificación para pedirles a sus clientes que acepten sus Términos de servicio.",
|
|
33
73
|
"email": "Correo electrónico",
|
|
74
|
+
"enable_postcode_lookup": "Ofrecer sugerencias de ciudades y estados según el código postal",
|
|
75
|
+
"enabled": "Activada",
|
|
34
76
|
"end_date": "Fecha de finalización",
|
|
35
77
|
"end_subscription": "Finalizar suscripción",
|
|
36
78
|
"end_subscription_explainer": "Su suscripción permanecerá activa hasta la fecha de finalización seleccionada. Es posible que deba volver a suscribirse si decide reanudar esta suscripción más adelante.",
|
|
37
79
|
"expires": "Caduca",
|
|
38
80
|
"field": "Campo",
|
|
81
|
+
"field_plural": "Campos",
|
|
39
82
|
"first_name": "Nombre",
|
|
83
|
+
"foxycomplete": "Autocompletar ubicación",
|
|
84
|
+
"foxycomplete_combobox": "Caja combo",
|
|
85
|
+
"foxycomplete_combobox_explainer": "Expandir para buscar opciones, escribir para buscar",
|
|
86
|
+
"foxycomplete_disabled": "Deshabilitada",
|
|
87
|
+
"foxycomplete_disabled_explainer": "Deje que los clientes elijan una opción de una lista",
|
|
88
|
+
"foxycomplete_search": "Búsqueda",
|
|
89
|
+
"foxycomplete_search_explainer": "Mostrar un campo de «búsqueda mientras escribe»",
|
|
40
90
|
"fraud_risk": "Riesgo de fraude: {{ score }}",
|
|
41
91
|
"frequency": "$t({{units}}, { \"count\": {{count}} })",
|
|
42
92
|
"frequency_label": "Frecuencia",
|
|
@@ -45,6 +95,13 @@
|
|
|
45
95
|
"frontend_developer_explainer": "Administra el código del lado del cliente en JS, CSS, HTML, etc.",
|
|
46
96
|
"full_address": "{{first_name}} {{last_name}}\n{{address1}} {{address2}}\n{{city}} {{region}} {{postal_code}}",
|
|
47
97
|
"full_name": "{{first_name}} {{last_name}}",
|
|
98
|
+
"ga_account_id": "Account ID",
|
|
99
|
+
"ga_account_id_explainer": "Puede encontrar el ID en la sección Administrador de Analytics en Información de seguimiento > Código de seguimiento.",
|
|
100
|
+
"ga_include_on_site": "Incluir a través de loader.js",
|
|
101
|
+
"ga_include_on_site_explainer": "Habilite Google Analytics en cualquier página donde se incluya el archivo loader.js.",
|
|
102
|
+
"hidden": "Oculta",
|
|
103
|
+
"hidden_fields": "Campos ocultos",
|
|
104
|
+
"html_template": "Plantilla HTML",
|
|
48
105
|
"invalid_credential_error": "Correo electrónico o contraseña incorrectos. Verifique sus credenciales y vuelva a intentarlo.",
|
|
49
106
|
"is_defined_false": "No definido",
|
|
50
107
|
"is_defined_true": "Definido",
|
|
@@ -59,6 +116,8 @@
|
|
|
59
116
|
"loading_end": "No más datos",
|
|
60
117
|
"loading_error": "No se pudo cargar",
|
|
61
118
|
"loading_paused": "En pausa",
|
|
119
|
+
"location_plural": "Ubicaciones",
|
|
120
|
+
"location_url": "Ubicación (URL)",
|
|
62
121
|
"merchant": "Comerciante",
|
|
63
122
|
"merchant_explainer": "Maneja artículos, finanzas y esta tienda en general.",
|
|
64
123
|
"mfa_remember_device": "Confía en este dispositivo",
|
|
@@ -74,7 +133,10 @@
|
|
|
74
133
|
"new_password": "Nueva contraseña",
|
|
75
134
|
"new_password_format_error": "La nueva contraseña que ha elegido es demasiado débil. Ingrese una nueva contraseña segura.",
|
|
76
135
|
"new_password_required_error": "Para mantener su cuenta segura, cambie su contraseña antes de iniciar sesión esta vez.",
|
|
136
|
+
"newsletter_subscribe": "Permitir a las usuarios suscribirse a su boletín",
|
|
137
|
+
"newsletter_subscribe_explainer": "Esto incluye una casilla de verificación en su pago para permitir que los clientes elijan suscribirse a su boletín informativo, disponible en los informes de transacciones, la API y los webhooks.",
|
|
77
138
|
"next_transaction_date": "Fecha de la próxima transacción",
|
|
139
|
+
"open_icon": "Icono abierto",
|
|
78
140
|
"operator_equal": "Igual",
|
|
79
141
|
"operator_greaterthan": "Mas grande que",
|
|
80
142
|
"operator_greaterthanorequal": "Mayor que o igual",
|
|
@@ -83,6 +145,7 @@
|
|
|
83
145
|
"operator_lessthan": "Menos que",
|
|
84
146
|
"operator_lessthanorequal": "Menor o igual",
|
|
85
147
|
"operator_not": "No es igual",
|
|
148
|
+
"optional": "Opcional",
|
|
86
149
|
"or": "O",
|
|
87
150
|
"password": "Contraseña",
|
|
88
151
|
"payment_method_plural": "Métodos de pago",
|
|
@@ -93,6 +156,10 @@
|
|
|
93
156
|
"price": "{{amount, price}}",
|
|
94
157
|
"price_recurring": "{{amount, price}} $t(frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\" })",
|
|
95
158
|
"price_twice_a_month": "{{amount, price}} $t(frequency_twice_a_month)",
|
|
159
|
+
"product_category": "Categoria de producto",
|
|
160
|
+
"product_code": "Código de producto",
|
|
161
|
+
"product_options": "Opciones de productos",
|
|
162
|
+
"product_weight": "Peso de producto",
|
|
96
163
|
"query_builder_group": "Grupo de filtros",
|
|
97
164
|
"query_builder_rule": "Filtro",
|
|
98
165
|
"range_from": "De",
|
|
@@ -103,16 +170,31 @@
|
|
|
103
170
|
"recover_access_success": "¡Hecho! Consulte su correo electrónico para obtener más instrucciones.",
|
|
104
171
|
"region": "Region",
|
|
105
172
|
"request": "Pedido",
|
|
173
|
+
"require_consent": "Requerir consentimiento para continuar",
|
|
174
|
+
"required": "Requerida",
|
|
175
|
+
"same_as_shipping": "La misma que el envío",
|
|
106
176
|
"save": "Guardar",
|
|
177
|
+
"shipping": "Transporte",
|
|
178
|
+
"show_country_flags": "Mostrar banderas de países",
|
|
107
179
|
"show_on_receipt": "Mostrar en recibo",
|
|
108
180
|
"sign_in": "Iniciar sesión",
|
|
109
181
|
"sign_in_hint": "Por favor, introduzca su correo electrónico y contraseña",
|
|
182
|
+
"sio_account_id": "Write Key",
|
|
183
|
+
"sio_account_id_explainer": "Puede encontrar Write Key en la guía de configuración de su proyecto o en la configuración de la fuente.",
|
|
184
|
+
"skip_csc_for_saved": "Omitir CSC para tarjetas guardadas",
|
|
185
|
+
"skip_csc_for_sso": "Omitir CSC para el inicio de sesión único",
|
|
186
|
+
"sub_enddate": "Fecha de finalización de la suscripción",
|
|
187
|
+
"sub_frequency": "Frecuencia de suscripción",
|
|
188
|
+
"sub_nextdate": "Suscripción próxima fecha",
|
|
189
|
+
"sub_startdate": "Fecha de inicio de la suscripción",
|
|
110
190
|
"subscription_active": "Próximo pago el {{date, date}}",
|
|
111
191
|
"subscription_cancelled": "Finalizó el {{date, date}}",
|
|
112
192
|
"subscription_failed": "Error en el pago el {{date, date}}",
|
|
113
193
|
"subscription_inactive": "Inactiva",
|
|
114
194
|
"subscription_plural": "Suscripciones",
|
|
115
195
|
"subscription_will_be_cancelled": "Finaliza el {{date, date}}",
|
|
196
|
+
"supported_cards": "Tarjetas",
|
|
197
|
+
"supported_cards_disclaimer": "Se aplica solo a las pasarelas de pago donde el cliente ingresa la información de su tarjeta de pago directamente en el proceso de pago de Foxy. Excepciones: Adyen Embedded, Amazon Pay, Apple Pay, Klarna, Square y Stripe.",
|
|
116
198
|
"tax_apply_to_shipping": "Aplicar al envío",
|
|
117
199
|
"tax_apply_to_shipping_explainer": "Marque para aplicar este impuesto a los costos de envío",
|
|
118
200
|
"tax_country": "Impuesto del país",
|
|
@@ -129,6 +211,14 @@
|
|
|
129
211
|
"tax_union": "Impuesto de la Unión Europea",
|
|
130
212
|
"tax_use_origin_rates": "Usar tasas impositivas de origen",
|
|
131
213
|
"tax_use_origin_rates_explainer": "Marque para usar la tasa impositiva de su país independientemente de dónde se encuentren los clientes",
|
|
214
|
+
"template": "Plantilla",
|
|
215
|
+
"template_clipboard": "Desde portapapeles",
|
|
216
|
+
"template_clipboard_explainer": "Pegue la plantilla aquí para usarla",
|
|
217
|
+
"template_default": "Defecto",
|
|
218
|
+
"template_default_explainer": "Usar la plantilla predeterminada",
|
|
219
|
+
"template_url": "Desde URL",
|
|
220
|
+
"template_url_explainer": "Obtener la plantilla de una URL pública",
|
|
221
|
+
"text_template": "Plantilla de texto",
|
|
132
222
|
"time": "{{value, time}}",
|
|
133
223
|
"transaction": "Transacción",
|
|
134
224
|
"transaction_approved": "Aprobado",
|
|
@@ -144,6 +234,9 @@
|
|
|
144
234
|
"transaction_summary_plural": "{{most_expensive_item.name}} y {{count}} más",
|
|
145
235
|
"transaction_verified": "Verificado",
|
|
146
236
|
"transaction_voided": "Anulado",
|
|
237
|
+
"troubleshooting": "Solución de problemas",
|
|
238
|
+
"troubleshooting_debug": "Registrar mensajes de depuración en la consola del navegador",
|
|
239
|
+
"troubleshooting_debug_explainer": "Habilite esta opción para activar las llamadas a console.log() para nuestro JS, lo que puede ayudar a solucionar los problemas de su tienda.",
|
|
147
240
|
"twice_a_month": "Dos veces al mes",
|
|
148
241
|
"type": "Tipo",
|
|
149
242
|
"type_any": "Campo de tipo desconocido",
|
|
@@ -4,6 +4,7 @@ declare const InternalCustomerPortalLink_base: typeof LitElement & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare class InternalCustomerPortalLink extends InternalCustomerPortalLink_base {
|
|
6
6
|
static get properties(): PropertyDeclarations;
|
|
7
|
+
disabled: boolean;
|
|
7
8
|
href: string;
|
|
8
9
|
icon: string;
|
|
9
10
|
render(): TemplateResult;
|
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit-element';
|
|
2
2
|
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
3
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
3
4
|
export class InternalCustomerPortalLink extends ThemeableMixin(LitElement) {
|
|
4
5
|
constructor() {
|
|
5
6
|
super(...arguments);
|
|
7
|
+
this.disabled = false;
|
|
6
8
|
this.href = '';
|
|
7
9
|
this.icon = '';
|
|
8
10
|
}
|
|
9
11
|
static get properties() {
|
|
10
12
|
return {
|
|
11
13
|
...super.properties,
|
|
14
|
+
disabled: { type: Boolean },
|
|
12
15
|
href: { type: String },
|
|
13
16
|
icon: { type: String },
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
render() {
|
|
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,
|
|
23
|
+
'focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2': !this.disabled,
|
|
24
|
+
'text-disabled cursor-default': this.disabled,
|
|
25
|
+
});
|
|
26
|
+
const actionContent = html `
|
|
27
|
+
${this.icon ? html `<iron-icon icon=${this.icon} class="icon-inline"></iron-icon>` : ''}
|
|
28
|
+
<slot></slot>
|
|
29
|
+
`;
|
|
30
|
+
if (this.disabled) {
|
|
31
|
+
return html `<button class=${actionClass} disabled>${actionContent}</button>`;
|
|
32
|
+
}
|
|
17
33
|
return html `
|
|
18
|
-
<a
|
|
19
|
-
class="flex-auto font-medium tracking-wide cursor-pointer text-s rounded-s hover-text-primary focus-text-primary focus-outline-none focus-ring-2 focus-ring-primary-50 focus-ring-offset-2"
|
|
20
|
-
href=${this.href}
|
|
21
|
-
rel="nofollow noopener"
|
|
22
|
-
>
|
|
23
|
-
${this.icon ? html `<iron-icon icon=${this.icon} class="icon-inline"></iron-icon>` : ''}
|
|
24
|
-
<slot></slot>
|
|
25
|
-
</a>
|
|
34
|
+
<a class=${actionClass} href=${this.href} rel="nofollow noopener">${actionContent}</a>
|
|
26
35
|
`;
|
|
27
36
|
}
|
|
28
37
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalLink.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLink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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 `;\n }\n}\n"]}
|
|
@@ -12,8 +12,10 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
12
12
|
this.customer = null;
|
|
13
13
|
this.group = '';
|
|
14
14
|
this.__renderFormHeaderActionsUpdate = (html, host) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const hasEnded = !!((_a = host.data) === null || _a === void 0 ? void 0 : _a.end_date) && new Date(host.data.end_date).getTime() <= Date.now();
|
|
15
17
|
let billingLink = '';
|
|
16
|
-
if (host.in({ idle: 'snapshot' })) {
|
|
18
|
+
if (!hasEnded && host.in({ idle: 'snapshot' })) {
|
|
17
19
|
const link = host.data._links['fx:sub_token_url'].href;
|
|
18
20
|
const updateBillingURL = new URL(link);
|
|
19
21
|
updateBillingURL.searchParams.set('cart', 'checkout');
|
|
@@ -27,6 +29,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
27
29
|
data-testid="header:actions:update"
|
|
28
30
|
href=${billingLink}
|
|
29
31
|
icon="icons:credit-card"
|
|
32
|
+
?disabled=${hasEnded || !host.in('idle')}
|
|
30
33
|
>
|
|
31
34
|
<foxy-i18n lang=${host.lang} key="update_billing" ns=${host.ns}></foxy-i18n>
|
|
32
35
|
</foxy-internal-customer-portal-link>
|
|
@@ -35,8 +38,10 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
35
38
|
`;
|
|
36
39
|
};
|
|
37
40
|
this.__renderFormHeaderActionsEnd = (html, host) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const hasEndDate = !!((_a = host.data) === null || _a === void 0 ? void 0 : _a.end_date);
|
|
38
43
|
let cancelLink = '';
|
|
39
|
-
if (host.in({ idle: 'snapshot' })) {
|
|
44
|
+
if (!hasEndDate && host.in({ idle: 'snapshot' })) {
|
|
40
45
|
const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);
|
|
41
46
|
cancelURL.searchParams.set('sub_cancel', 'true');
|
|
42
47
|
cancelLink = cancelURL.toString();
|
|
@@ -48,6 +53,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
48
53
|
data-testid="header:actions:end"
|
|
49
54
|
href=${cancelLink}
|
|
50
55
|
icon="icons:block"
|
|
56
|
+
?disabled=${hasEndDate || !host.in('idle')}
|
|
51
57
|
>
|
|
52
58
|
<foxy-i18n lang=${host.lang} key="end_subscription" ns=${host.ns}></foxy-i18n>
|
|
53
59
|
</foxy-internal-customer-portal-link>
|
|
@@ -81,9 +87,10 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
81
87
|
`;
|
|
82
88
|
};
|
|
83
89
|
this.__renderFormItemsActionsUpdate = (html, host) => {
|
|
84
|
-
var _a, _b, _c;
|
|
90
|
+
var _a, _b, _c, _d;
|
|
85
91
|
// @ts-expect-error missing typedef in SDK
|
|
86
92
|
const itemsLink = (_c = (_b = (_a = host.data) === null || _a === void 0 ? void 0 : _a._links['fx:sub_modification_url']) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : '';
|
|
93
|
+
const hasEnded = !!((_d = host.data) === null || _d === void 0 ? void 0 : _d.end_date) && new Date(host.data.end_date).getTime() <= Date.now();
|
|
87
94
|
return html `
|
|
88
95
|
${host.renderTemplateOrSlot('items:actions:update:before')}
|
|
89
96
|
|
|
@@ -91,6 +98,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
|
|
|
91
98
|
data-testid="items:actions:update"
|
|
92
99
|
class="text-primary"
|
|
93
100
|
href=${itemsLink}
|
|
101
|
+
?disabled=${hasEnded || !host.in('idle')}
|
|
94
102
|
>
|
|
95
103
|
<foxy-i18n lang=${host.lang} key="update_items" ns=${host.ns}></foxy-i18n>
|
|
96
104
|
</foxy-internal-customer-portal-link>
|
|
@@ -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;AAQrF,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;AAE3D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAC5F,IAAI,WAAW,GAAG,EAAE,CAAC;YAErB,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EA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,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,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 { 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';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(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 let billingLink = '';\n\n if (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 >\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 let cancelLink = '';\n\n if (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 >\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 // @ts-expect-error missing typedef in SDK\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\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 >\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=${ctx.dialog.hiddenControls.toString()}\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}\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', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\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-semibold\"\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', 'last_transaction,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;AAQrF,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;AAE3D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAA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AAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAgQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,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 { 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';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(LitElement)));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n // @ts-expect-error missing typedef in SDK\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=${ctx.dialog.hiddenControls.toString()}\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}\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', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\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-semibold\"\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', 'last_transaction,transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSResultArray, LitElement, PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
2
|
import { PreviewItem } from './Preview';
|
|
3
3
|
export declare class Picture extends LitElement {
|
|
4
|
+
static readonly 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";
|
|
4
5
|
static get properties(): PropertyDeclarations;
|
|
5
6
|
static get styles(): CSSResultArray;
|
|
6
7
|
quantity: number;
|
|
@@ -141,6 +141,7 @@ export class Picture extends LitElement {
|
|
|
141
141
|
const image = new Image();
|
|
142
142
|
image.src = this.image;
|
|
143
143
|
image.setAttribute('part', 'picture');
|
|
144
|
+
image.addEventListener('error', () => (image.src = Picture.placeholder));
|
|
144
145
|
this.__setImageState(image, state);
|
|
145
146
|
this.__container.insertBefore(image, refChild);
|
|
146
147
|
return image;
|
|
@@ -158,4 +159,5 @@ export class Picture extends LitElement {
|
|
|
158
159
|
image.className = [shared, states[state]].join(' ');
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
Picture.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';
|
|
161
163
|
//# sourceMappingURL=Picture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picture.js","sourceRoot":"","sources":["../../../../../src/elements/public/ItemsForm/private/Picture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,wCAAqC;AAEzD,IAAK,UAMJ;AAND,WAAK,UAAU;IACb,mDAAY,CAAA;IACZ,yDAAe,CAAA;IACf,iDAAW,CAAA;IACX,mDAAY,CAAA;IACZ,uDAAc,CAAA;AAChB,CAAC,EANI,UAAU,KAAV,UAAU,QAMd;AAED,MAAM,OAAO,OAAQ,SAAQ,UAAU;IAAvC;;QAgDS,aAAQ,GAAG,CAAC,CAAC;QAEb,UAAK,GAAG,EAAE,CAAC;IA+GpB,CAAC;IAhKQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SAC5B,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,MAAM;QACtB,OAAO;YACL,SAAS,CAAC,MAAM;YAChB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCF;SACF,CAAC;IACJ,CAAC;IAMD,IAAW,KAAK,CAAC,QAAiB;QAChC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE;YAC5B,IAAI,QAAQ,EAAE;gBACZ,MAAM,CAAC,EAAE,GAAG,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;gBACzC,YA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C,YAAY,CAAC,CAAC,SAAS;QAClC,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { PreviewItem } from './Preview';\nimport { Themeable } from '../../../../mixins/themeable';\n\nenum ImageState {\n Excluded = 0,\n BeforeEnter = 1,\n Default = 2,\n Previous = 3,\n BeforeExit = 4,\n}\n\nexport class Picture extends LitElement {\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n quantity: { attribute: false },\n image: { attribute: false },\n };\n }\n\n public static get styles(): CSSResultArray {\n return [\n Themeable.styles,\n css`\n .ease-out-back {\n transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .blur-1 {\n filter: blur(1px);\n }\n\n .blur-2 {\n filter: blur(2px);\n }\n\n .grayscale {\n filter: grayscale();\n }\n\n .rotate-12 {\n --tw-rotate: 12deg;\n }\n\n .-rotate-12 {\n --tw-rotate: -12deg;\n }\n\n .-rotate-24 {\n --tw-rotate: -24deg;\n }\n\n .translate-y-half {\n --tw-translate-y: 50%;\n }\n `,\n ];\n }\n\n public quantity = 0;\n\n public image = '';\n\n public set empty(newValue: boolean) {\n this.updateComplete.then(() => {\n if (newValue) {\n const [, ...bottomImages] = this.__stack;\n bottomImages.forEach(image => image.remove());\n } else if (this.quantity > 1 && this.__stack.length < 2) {\n this.__insertImage(ImageState.Previous, this.__stack[0]);\n }\n });\n }\n\n public set data({ quantity, image }: PreviewItem) {\n this.quantity = quantity;\n this.image = image;\n }\n\n public render(): TemplateResult {\n return html`<div id=\"image\" class=\"w-full h-full relative\"></div>`;\n }\n\n public firstUpdated(): void {\n const top = this.__insertImage(ImageState.Default);\n if (this.quantity > 1) this.__insertImage(ImageState.Previous, top);\n }\n\n public updated(changedProperties: Map<keyof Picture, unknown>): void {\n if (changedProperties.has('quantity')) {\n const oldValue = changedProperties.get('quantity') as number | undefined;\n if (oldValue !== undefined) this.quantity > oldValue ? this.__add() : this.__remove();\n }\n\n if (changedProperties.has('image')) {\n this.__stack.forEach(image => (image.src = this.image));\n }\n }\n\n private get __container() {\n return this.shadowRoot!.getElementById('image')!;\n }\n\n private get __stack() {\n const list = this.__container?.querySelectorAll(':not(.opacity-0)') ?? [];\n return [...list].reverse() as HTMLImageElement[];\n }\n\n private __add() {\n const [current, previous] = this.__stack;\n\n if (this.quantity > 1) {\n if (current) this.__setImageState(current, ImageState.Previous);\n\n if (previous) {\n this.__setImageState(previous, ImageState.BeforeExit);\n previous.ontransitionend = /* istanbul ignore next */ () => previous.remove();\n }\n\n this.__setImageState(this.__insertImage(ImageState.BeforeEnter), ImageState.Default);\n } else {\n if (current) this.__setImageState(current, ImageState.Default);\n }\n }\n\n private __remove() {\n const [current, previous] = this.__stack;\n let imageToRemove: HTMLImageElement;\n\n if (this.quantity > 0) {\n if (previous) this.__setImageState(previous, ImageState.Default);\n imageToRemove = current;\n } else {\n if (current) this.__setImageState(current, ImageState.Excluded);\n imageToRemove = previous;\n }\n\n if (imageToRemove) {\n this.__setImageState(imageToRemove, ImageState.BeforeEnter);\n imageToRemove.ontransitionend = /* istanbul ignore next */ () => imageToRemove!.remove();\n }\n\n if (this.quantity > 1) {\n const last = this.__insertImage(ImageState.BeforeExit, this.__container.firstElementChild);\n this.__setImageState(last, ImageState.Previous);\n }\n }\n\n private __insertImage(state: ImageState, refChild: Node | null = null) {\n const image = new Image();\n image.src = this.image;\n image.setAttribute('part', 'picture');\n this.__setImageState(image, state);\n this.__container.insertBefore(image, refChild);\n return image;\n }\n\n private __setImageState(image: HTMLImageElement, state: ImageState) {\n const shared =\n 'absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back';\n\n const states = [\n 'grayscale',\n 'shadow-m translate-y-half scale-110 rotate-12 opacity-0',\n 'shadow-m',\n 'blur-1 -rotate-12 opacity-25',\n 'blur-2 -rotate-24 opacity-0',\n ];\n\n void image.offsetHeight; // reflow\n image.className = [shared, states[state]].join(' ');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Picture.js","sourceRoot":"","sources":["../../../../../src/elements/public/ItemsForm/private/Picture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,SAAS,EAAE,wCAAqC;AAEzD,IAAK,UAMJ;AAND,WAAK,UAAU;IACb,mDAAY,CAAA;IACZ,yDAAe,CAAA;IACf,iDAAW,CAAA;IACX,mDAAY,CAAA;IACZ,uDAAc,CAAA;AAChB,CAAC,EANI,UAAU,KAAV,UAAU,QAMd;AAED,MAAM,OAAO,OAAQ,SAAQ,UAAU;IAAvC;;QAmDS,aAAQ,GAAG,CAAC,CAAC;QAEb,UAAK,GAAG,EAAE,CAAC;IAkHpB,CAAC;IAnKQ,MAAM,KAAK,UAAU;QAC1B,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SAC5B,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,MAAM;QACtB,OAAO;YACL,SAAS,CAAC,MAAM;YAChB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCF;SACF,CAAC;IACJ,CAAC;IAMD,IAAW,KAAK,CAAC,QAAiB;QAChC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE;YAC5B,IAAI,QAAQ,EAAE;gBACZ,MAAM,CAAC,EAAE,GAAG,YAAY,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;gBACzC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;aAC/C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BAA6B;SAC9B,CAAC;QAEF,KAAK,KAAK,CAAC,YAAY,CAAC,CAAC,SAAS;QAClC,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;;AArKsB,mBAAW,GAChC,+wDAA+wD,CAAC","sourcesContent":["import {\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\n\nimport { PreviewItem } from './Preview';\nimport { Themeable } from '../../../../mixins/themeable';\n\nenum ImageState {\n Excluded = 0,\n BeforeEnter = 1,\n Default = 2,\n Previous = 3,\n BeforeExit = 4,\n}\n\nexport class Picture extends LitElement {\n public 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 public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n quantity: { attribute: false },\n image: { attribute: false },\n };\n }\n\n public static get styles(): CSSResultArray {\n return [\n Themeable.styles,\n css`\n .ease-out-back {\n transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .blur-1 {\n filter: blur(1px);\n }\n\n .blur-2 {\n filter: blur(2px);\n }\n\n .grayscale {\n filter: grayscale();\n }\n\n .rotate-12 {\n --tw-rotate: 12deg;\n }\n\n .-rotate-12 {\n --tw-rotate: -12deg;\n }\n\n .-rotate-24 {\n --tw-rotate: -24deg;\n }\n\n .translate-y-half {\n --tw-translate-y: 50%;\n }\n `,\n ];\n }\n\n public quantity = 0;\n\n public image = '';\n\n public set empty(newValue: boolean) {\n this.updateComplete.then(() => {\n if (newValue) {\n const [, ...bottomImages] = this.__stack;\n bottomImages.forEach(image => image.remove());\n } else if (this.quantity > 1 && this.__stack.length < 2) {\n this.__insertImage(ImageState.Previous, this.__stack[0]);\n }\n });\n }\n\n public set data({ quantity, image }: PreviewItem) {\n this.quantity = quantity;\n this.image = image;\n }\n\n public render(): TemplateResult {\n return html`<div id=\"image\" class=\"w-full h-full relative\"></div>`;\n }\n\n public firstUpdated(): void {\n const top = this.__insertImage(ImageState.Default);\n if (this.quantity > 1) this.__insertImage(ImageState.Previous, top);\n }\n\n public updated(changedProperties: Map<keyof Picture, unknown>): void {\n if (changedProperties.has('quantity')) {\n const oldValue = changedProperties.get('quantity') as number | undefined;\n if (oldValue !== undefined) this.quantity > oldValue ? this.__add() : this.__remove();\n }\n\n if (changedProperties.has('image')) {\n this.__stack.forEach(image => (image.src = this.image));\n }\n }\n\n private get __container() {\n return this.shadowRoot!.getElementById('image')!;\n }\n\n private get __stack() {\n const list = this.__container?.querySelectorAll(':not(.opacity-0)') ?? [];\n return [...list].reverse() as HTMLImageElement[];\n }\n\n private __add() {\n const [current, previous] = this.__stack;\n\n if (this.quantity > 1) {\n if (current) this.__setImageState(current, ImageState.Previous);\n\n if (previous) {\n this.__setImageState(previous, ImageState.BeforeExit);\n previous.ontransitionend = /* istanbul ignore next */ () => previous.remove();\n }\n\n this.__setImageState(this.__insertImage(ImageState.BeforeEnter), ImageState.Default);\n } else {\n if (current) this.__setImageState(current, ImageState.Default);\n }\n }\n\n private __remove() {\n const [current, previous] = this.__stack;\n let imageToRemove: HTMLImageElement;\n\n if (this.quantity > 0) {\n if (previous) this.__setImageState(previous, ImageState.Default);\n imageToRemove = current;\n } else {\n if (current) this.__setImageState(current, ImageState.Excluded);\n imageToRemove = previous;\n }\n\n if (imageToRemove) {\n this.__setImageState(imageToRemove, ImageState.BeforeEnter);\n imageToRemove.ontransitionend = /* istanbul ignore next */ () => imageToRemove!.remove();\n }\n\n if (this.quantity > 1) {\n const last = this.__insertImage(ImageState.BeforeExit, this.__container.firstElementChild);\n this.__setImageState(last, ImageState.Previous);\n }\n }\n\n private __insertImage(state: ImageState, refChild: Node | null = null) {\n const image = new Image();\n\n image.src = this.image;\n image.setAttribute('part', 'picture');\n image.addEventListener('error', () => (image.src = Picture.placeholder));\n\n this.__setImageState(image, state);\n this.__container.insertBefore(image, refChild);\n return image;\n }\n\n private __setImageState(image: HTMLImageElement, state: ImageState) {\n const shared =\n 'absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back';\n\n const states = [\n 'grayscale',\n 'shadow-m translate-y-half scale-110 rotate-12 opacity-0',\n 'shadow-m',\n 'blur-1 -rotate-12 opacity-25',\n 'blur-2 -rotate-24 opacity-0',\n ];\n\n void image.offsetHeight; // reflow\n image.className = [shared, states[state]].join(' ');\n }\n}\n"]}
|
|
@@ -466,20 +466,28 @@ export class SubscriptionForm extends Base {
|
|
|
466
466
|
get __isNextTransactionDateVisible() {
|
|
467
467
|
if (this.hiddenSelector.matches('next-transaction-date', true))
|
|
468
468
|
return false;
|
|
469
|
-
if (this.settings === null)
|
|
470
|
-
return true;
|
|
471
469
|
if (this.data === null)
|
|
472
470
|
return false;
|
|
471
|
+
if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now())
|
|
472
|
+
return false;
|
|
473
|
+
if (this.data.is_active === false)
|
|
474
|
+
return false;
|
|
475
|
+
if (this.settings === null)
|
|
476
|
+
return true;
|
|
473
477
|
const rules = this.settings.subscriptions.allow_next_date_modification;
|
|
474
478
|
return !!getNextTransactionDateConstraints(this.data, rules);
|
|
475
479
|
}
|
|
476
480
|
get __isFrequencyVisible() {
|
|
477
481
|
if (this.hiddenSelector.matches('frequency', true))
|
|
478
482
|
return false;
|
|
479
|
-
if (this.settings === null)
|
|
480
|
-
return true;
|
|
481
483
|
if (this.data === null)
|
|
482
484
|
return false;
|
|
485
|
+
if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now())
|
|
486
|
+
return false;
|
|
487
|
+
if (this.data.is_active === false)
|
|
488
|
+
return false;
|
|
489
|
+
if (this.settings === null)
|
|
490
|
+
return true;
|
|
483
491
|
const allowedFrequencies = getAllowedFrequencies({
|
|
484
492
|
subscription: this.data,
|
|
485
493
|
settings: this.settings,
|