@foxy.io/elements 1.14.0-beta.8 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-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-31d03530.js → shared-1f1734cb.js} +1 -1
- package/dist/cdn/{shared-ca7c3b9a.js → shared-322e60b1.js} +1 -1
- package/dist/cdn/{shared-7007dedb.js → shared-5f54e916.js} +1 -1
- package/dist/cdn/{shared-0f9809ab.js → shared-66cb6a36.js} +1 -1
- package/dist/cdn/{shared-a3d2c48e.js → shared-6ebe3825.js} +1 -1
- package/dist/cdn/{shared-5d94bacb.js → shared-74b9e1d1.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-9c099da6.js +1 -0
- package/dist/cdn/{shared-daf6b763.js → shared-b1fc5dc3.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-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/InternalCustomerPortalLoggedInView.js +19 -6
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.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/EmailTemplateForm/EmailTemplateForm.d.ts +21 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +21 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/I18n/I18n.js +1 -1
- package/dist/elements/public/I18n/I18n.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 +184 -166
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.d.ts +21 -0
- package/dist/elements/public/TemplateForm/TemplateForm.js +21 -0
- package/dist/elements/public/TemplateForm/TemplateForm.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.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 `;\n }\n}\n"]}
|
|
@@ -114,21 +114,34 @@ export class InternalCustomerPortalLoggedInView extends Base {
|
|
|
114
114
|
render() {
|
|
115
115
|
var _a, _b;
|
|
116
116
|
const hiddenSelector = this.hiddenSelector.zoom('customer');
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
'header:actions:edit:form:delete',
|
|
117
|
+
const optionallyHiddenInCustomer = ['payment-methods'];
|
|
118
|
+
const alwaysHiddenInCustomer = [
|
|
120
119
|
'attributes',
|
|
121
120
|
'transactions',
|
|
122
121
|
'subscriptions',
|
|
123
122
|
'addresses:actions:create',
|
|
124
|
-
'
|
|
123
|
+
'header:actions:edit:form:delete',
|
|
124
|
+
];
|
|
125
|
+
const customerHiddenControls = [
|
|
126
|
+
...optionallyHiddenInCustomer
|
|
127
|
+
.filter(id => hiddenSelector.matches(id))
|
|
128
|
+
.map(id => `${id}:${hiddenSelector.zoom(id)}`),
|
|
129
|
+
...alwaysHiddenInCustomer.map(id => {
|
|
130
|
+
const splitId = id.split(':');
|
|
131
|
+
for (let i = 0; i < splitId.length; ++i) {
|
|
132
|
+
const hostId = splitId.slice(0, i + 1).join(':');
|
|
133
|
+
if (hiddenSelector.matches(hostId, true))
|
|
134
|
+
return hostId;
|
|
135
|
+
}
|
|
136
|
+
return id;
|
|
137
|
+
}),
|
|
125
138
|
];
|
|
126
139
|
const templates = this.getNestedTemplates('customer');
|
|
127
140
|
const originalHeaderActionsAfterTemplate = templates['header:actions:after'];
|
|
128
141
|
const originalTimestampsAfterTemplate = templates['header:actions:edit:form:timestamps:after'];
|
|
129
142
|
const originalDefaultTemplate = templates['default'];
|
|
130
143
|
templates['header:actions:after'] = (html, host) => {
|
|
131
|
-
const isSignOutHidden =
|
|
144
|
+
const isSignOutHidden = hiddenSelector.matches('header:actions:sign-out', true);
|
|
132
145
|
return html `
|
|
133
146
|
<div style="display:flex">
|
|
134
147
|
${isSignOutHidden ? '' : this.__renderHeaderActionsSignOut()}
|
|
@@ -185,7 +198,7 @@ export class InternalCustomerPortalLoggedInView extends Base {
|
|
|
185
198
|
<foxy-customer
|
|
186
199
|
readonlycontrols=${this.readonlySelector.zoom('customer').toString()}
|
|
187
200
|
disabledcontrols=${this.disabledSelector.zoom('customer').toString()}
|
|
188
|
-
hiddencontrols=${
|
|
201
|
+
hiddencontrols=${customerHiddenControls.join(' ')}
|
|
189
202
|
data-testid="customer"
|
|
190
203
|
group=${this.group}
|
|
191
204
|
href=${this.customer}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalLoggedInView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAC3E,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAG5C,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAKlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAGlF,MAAM,OAAO,kCAAmC,SAAQ,IAAU;IAAlE;;QAUE,cAAS,GAAc,EAAE,CAAC;QAE1B,aAAQ,GAAG,EAAE,CAAC;QAEd,oBAAe,GAA6B,MAAM,CAAC;QAEnD,gCAA2B,GAA0B,IAAI,CAAC;QAEzC,iCAA4B,GAAG,GAAG,EAAE;;YACnD,MAAM,KAAK,GAAG,kCAAkC,CAAC;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;YACnC,MAAM,gBAAgB,GAAG,CAAC,QAAC,IAAI,CAAC,iBAAiB,0CAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAC,CAAC;YAC5E,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;gBAC7B,IAAI;oBACF,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;oBAC9B,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,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IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;2BACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;yBACnD,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;;gBAErD,IAAI,CAAC,KAAK;eACX,IAAI,CAAC,QAAQ;eACb,IAAI,CAAC,IAAI;cACV,IAAI,CAAC,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC,0CAAE,SAAS,mCAAI,EAAE;;qBAExD,SAAS;kBACZ,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,2BAA2B;YAAE,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACvF,CAAC;IAED,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAW,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../NucleonElement/API';\nimport { Customer } from '../Customer/Customer';\nimport { Templates as CustomerTemplates } from '../Customer/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Templates } from './types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement)));\ntype Data = Resource<Rels.CustomerPortalSettings>;\n\nexport class InternalCustomerPortalLoggedInView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customer: { type: String },\n loggingOutState: { attribute: false },\n loggingOutStateResetTimeout: { attribute: false },\n };\n }\n\n templates: Templates = {};\n\n customer = '';\n\n loggingOutState: 'idle' | 'busy' | 'fail' = 'idle';\n\n loggingOutStateResetTimeout: NodeJS.Timeout | null = null;\n\n private readonly __renderHeaderActionsSignOut = () => {\n const scope = 'customer:header:actions:sign-out';\n const state = this.loggingOutState;\n const isCustomerLoaded = !!this.__customerElement?.in({ idle: 'snapshot' });\n const handleClick = async () => {\n try {\n this.loggingOutState = 'busy';\n await new API(this).fetch('foxy://customer-api/session', { method: 'DELETE' });\n this.loggingOutState = 'idle';\n } catch {\n this.loggingOutState = 'fail';\n this.loggingOutStateResetTimeout = setTimeout(() => {\n this.loggingOutState = 'idle';\n this.loggingOutStateResetTimeout = null;\n }, 1000);\n }\n };\n\n return html`\n <div style=\"display: flex; margin-left: var(--lumo-space-m)\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-button\n data-testid=\"sign-out\"\n aria-label=${this.t('sign_out').toString()}\n style=\"padding: var(--lumo-space-xs); margin: 0; border-radius: 100%; display: flex\"\n theme=\"icon\"\n ?disabled=${this.disabledSelector.matches(scope) || !isCustomerLoaded || state !== 'idle'}\n @click=${handleClick}\n >\n ${state === 'idle'\n ? html`<iron-icon icon=\"icons:exit-to-app\"></iron-icon>`\n : html`\n <foxy-spinner\n layout=\"no-label\"\n state=${state === 'fail' ? 'error' : 'busy'}\n style=\"margin: auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n `}\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSubscriptions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:subscriptions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-subscriptions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .settings=${this.data}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-subscriptions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n private readonly __renderTransactions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:transactions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-transactions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-transactions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector.zoom('customer');\n const extendedhiddencontrolsArray = [\n hiddenSelector.toString(),\n 'header:actions:edit:form:delete',\n 'attributes',\n 'transactions',\n 'subscriptions',\n 'addresses:actions:create',\n 'payment-methods:list:card',\n ];\n\n const templates: CustomerTemplates = this.getNestedTemplates('customer');\n const originalHeaderActionsAfterTemplate = templates['header:actions:after'];\n const originalTimestampsAfterTemplate = templates['header:actions:edit:form:timestamps:after'];\n const originalDefaultTemplate = templates['default'];\n\n templates['header:actions:after'] = (html, host) => {\n const isSignOutHidden = host.hiddenSelector.matches('header:actions:sign-out', true);\n return html`\n <div style=\"display:flex\">\n ${isSignOutHidden ? '' : this.__renderHeaderActionsSignOut()}\n ${originalHeaderActionsAfterTemplate?.(html, host)}\n </div>\n `;\n };\n\n templates['default'] = (html, host) => {\n const renderSubscriptions = this.__renderSubscriptions;\n const renderTransactions = this.__renderTransactions;\n\n return html`\n <style>\n .space-y-m > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(var(--lumo-space-m, 1rem) * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(var(--lumo-space-m, 1rem) * var(--tw-space-y-reverse));\n }\n </style>\n\n ${hiddenSelector.matches('default', true) ? '' : originalDefaultTemplate?.(html, host)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('subscriptions', true) ? '' : renderSubscriptions(html, host)}\n ${hiddenSelector.matches('transactions', true) ? '' : renderTransactions(html, host)}\n </div>\n `;\n };\n\n templates['header:actions:edit:form:timestamps:after'] = (html, host) => {\n const scope = 'change-password';\n\n return html`\n ${originalTimestampsAfterTemplate?.(html, host)}\n ${host.hiddenSelector.matches(scope, true)\n ? ''\n : html`\n ${host.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-change-password\n customer=${host.href}\n session=\"foxy://customer-api/session\"\n style=\"margin-top: var(--lumo-space-l)\"\n email=${host.data?.email ?? ''}\n lang=${host.lang}\n ns=${host.ns}\n ?disabled=${host.in('busy') || host.disabledSelector.matches(scope, true)}\n >\n </foxy-internal-customer-portal-change-password>\n\n ${host.renderTemplateOrSlot(`${scope}:after`)}\n `}\n `;\n };\n\n return html`\n <foxy-customer\n readonlycontrols=${this.readonlySelector.zoom('customer').toString()}\n disabledcontrols=${this.disabledSelector.zoom('customer').toString()}\n hiddencontrols=${extendedhiddencontrolsArray.join(' ').trim()}\n data-testid=\"customer\"\n group=${this.group}\n href=${this.customer}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n id=\"customer\"\n .templates=${templates}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.loggingOutStateResetTimeout) clearTimeout(this.loggingOutStateResetTimeout);\n }\n\n private get __customerElement() {\n return this.renderRoot.querySelector<Customer>('#customer');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalCustomerPortalLoggedInView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAC3E,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,iCAA8B;AAG5C,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAKlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAGlF,MAAM,OAAO,kCAAmC,SAAQ,IAAU;IAAlE;;QAUE,cAAS,GAAc,EAAE,CAAC;QAE1B,aAAQ,GAAG,EAAE,CAAC;QAEd,oBAAe,GAA6B,MAAM,CAAC;QAEnD,gCAA2B,GAA0B,IAAI,CAAC;QAEzC,iCAA4B,GAAG,GAAG,EAAE;;YACnD,MAAM,KAAK,GAAG,kCAAkC,CAAC;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;YACnC,MAAM,gBAAgB,GAAG,CAAC,QAAC,IAAI,CAAC,iBAAiB,0CAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAC,CAAC;YAC5E,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;gBAC7B,IAAI;oBACF,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;oBAC9B,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;oBAC/E,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;iBAC/B;gBAAC,WAAM;oBACN,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;oBAC9B,IAAI,CAAC,2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Aa,CAAW,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../NucleonElement/API';\nimport { Customer } from '../Customer/Customer';\nimport { Templates as CustomerTemplates } from '../Customer/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Templates } from './types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\n\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement)));\ntype Data = Resource<Rels.CustomerPortalSettings>;\n\nexport class InternalCustomerPortalLoggedInView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n customer: { type: String },\n loggingOutState: { attribute: false },\n loggingOutStateResetTimeout: { attribute: false },\n };\n }\n\n templates: Templates = {};\n\n customer = '';\n\n loggingOutState: 'idle' | 'busy' | 'fail' = 'idle';\n\n loggingOutStateResetTimeout: NodeJS.Timeout | null = null;\n\n private readonly __renderHeaderActionsSignOut = () => {\n const scope = 'customer:header:actions:sign-out';\n const state = this.loggingOutState;\n const isCustomerLoaded = !!this.__customerElement?.in({ idle: 'snapshot' });\n const handleClick = async () => {\n try {\n this.loggingOutState = 'busy';\n await new API(this).fetch('foxy://customer-api/session', { method: 'DELETE' });\n this.loggingOutState = 'idle';\n } catch {\n this.loggingOutState = 'fail';\n this.loggingOutStateResetTimeout = setTimeout(() => {\n this.loggingOutState = 'idle';\n this.loggingOutStateResetTimeout = null;\n }, 1000);\n }\n };\n\n return html`\n <div style=\"display: flex; margin-left: var(--lumo-space-m)\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-button\n data-testid=\"sign-out\"\n aria-label=${this.t('sign_out').toString()}\n style=\"padding: var(--lumo-space-xs); margin: 0; border-radius: 100%; display: flex\"\n theme=\"icon\"\n ?disabled=${this.disabledSelector.matches(scope) || !isCustomerLoaded || state !== 'idle'}\n @click=${handleClick}\n >\n ${state === 'idle'\n ? html`<iron-icon icon=\"icons:exit-to-app\"></iron-icon>`\n : html`\n <foxy-spinner\n layout=\"no-label\"\n state=${state === 'fail' ? 'error' : 'busy'}\n style=\"margin: auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n `}\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSubscriptions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:subscriptions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-subscriptions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .settings=${this.data}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-subscriptions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n private readonly __renderTransactions: Renderer<Customer> = (html, host) => {\n const scope = 'customer:transactions';\n\n return html`\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-transactions\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${this.hiddenSelector.zoom(scope).toString()}\n group=${host.group}\n lang=${host.lang}\n ns=${host.ns}\n .templates=${this.getNestedTemplates(scope)}\n .customer=${host.data}\n >\n </foxy-internal-customer-portal-transactions>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n `;\n };\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector.zoom('customer');\n const optionallyHiddenInCustomer = ['payment-methods'];\n const alwaysHiddenInCustomer = [\n 'attributes',\n 'transactions',\n 'subscriptions',\n 'addresses:actions:create',\n 'header:actions:edit:form:delete',\n ];\n\n const customerHiddenControls = [\n ...optionallyHiddenInCustomer\n .filter(id => hiddenSelector.matches(id))\n .map(id => `${id}:${hiddenSelector.zoom(id)}`),\n\n ...alwaysHiddenInCustomer.map(id => {\n const splitId = id.split(':');\n\n for (let i = 0; i < splitId.length; ++i) {\n const hostId = splitId.slice(0, i + 1).join(':');\n if (hiddenSelector.matches(hostId, true)) return hostId;\n }\n\n return id;\n }),\n ];\n\n const templates: CustomerTemplates = this.getNestedTemplates('customer');\n const originalHeaderActionsAfterTemplate = templates['header:actions:after'];\n const originalTimestampsAfterTemplate = templates['header:actions:edit:form:timestamps:after'];\n const originalDefaultTemplate = templates['default'];\n\n templates['header:actions:after'] = (html, host) => {\n const isSignOutHidden = hiddenSelector.matches('header:actions:sign-out', true);\n return html`\n <div style=\"display:flex\">\n ${isSignOutHidden ? '' : this.__renderHeaderActionsSignOut()}\n ${originalHeaderActionsAfterTemplate?.(html, host)}\n </div>\n `;\n };\n\n templates['default'] = (html, host) => {\n const renderSubscriptions = this.__renderSubscriptions;\n const renderTransactions = this.__renderTransactions;\n\n return html`\n <style>\n .space-y-m > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(var(--lumo-space-m, 1rem) * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(var(--lumo-space-m, 1rem) * var(--tw-space-y-reverse));\n }\n </style>\n\n ${hiddenSelector.matches('default', true) ? '' : originalDefaultTemplate?.(html, host)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('subscriptions', true) ? '' : renderSubscriptions(html, host)}\n ${hiddenSelector.matches('transactions', true) ? '' : renderTransactions(html, host)}\n </div>\n `;\n };\n\n templates['header:actions:edit:form:timestamps:after'] = (html, host) => {\n const scope = 'change-password';\n\n return html`\n ${originalTimestampsAfterTemplate?.(html, host)}\n ${host.hiddenSelector.matches(scope, true)\n ? ''\n : html`\n ${host.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-internal-customer-portal-change-password\n customer=${host.href}\n session=\"foxy://customer-api/session\"\n style=\"margin-top: var(--lumo-space-l)\"\n email=${host.data?.email ?? ''}\n lang=${host.lang}\n ns=${host.ns}\n ?disabled=${host.in('busy') || host.disabledSelector.matches(scope, true)}\n >\n </foxy-internal-customer-portal-change-password>\n\n ${host.renderTemplateOrSlot(`${scope}:after`)}\n `}\n `;\n };\n\n return html`\n <foxy-customer\n readonlycontrols=${this.readonlySelector.zoom('customer').toString()}\n disabledcontrols=${this.disabledSelector.zoom('customer').toString()}\n hiddencontrols=${customerHiddenControls.join(' ')}\n data-testid=\"customer\"\n group=${this.group}\n href=${this.customer}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-customer')?.defaultNS ?? ''}\"\n id=\"customer\"\n .templates=${templates}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.loggingOutStateResetTimeout) clearTimeout(this.loggingOutStateResetTimeout);\n }\n\n private get __customerElement() {\n return this.renderRoot.querySelector<Customer>('#customer');\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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AC,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 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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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"]}
|
|
@@ -7,6 +7,27 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
|
|
|
7
7
|
} & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
|
|
8
8
|
styles: CSSResultArray;
|
|
9
9
|
} & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
|
|
10
|
+
/**
|
|
11
|
+
* Form element for creating or editing email templates (`fx:email_template`).
|
|
12
|
+
*
|
|
13
|
+
* @slot description:before
|
|
14
|
+
* @slot description:after
|
|
15
|
+
*
|
|
16
|
+
* @slot content:before
|
|
17
|
+
* @slot content:after
|
|
18
|
+
*
|
|
19
|
+
* @slot timestamps:before
|
|
20
|
+
* @slot timestamps:after
|
|
21
|
+
*
|
|
22
|
+
* @slot create:before
|
|
23
|
+
* @slot create:after
|
|
24
|
+
*
|
|
25
|
+
* @slot delete:before
|
|
26
|
+
* @slot delete:after
|
|
27
|
+
*
|
|
28
|
+
* @element foxy-email-template-form
|
|
29
|
+
* @since 1.14.0
|
|
30
|
+
*/
|
|
10
31
|
export declare class EmailTemplateForm extends Base<Data> {
|
|
11
32
|
static get properties(): PropertyDeclarations;
|
|
12
33
|
static get styles(): CSSResultArray;
|
|
@@ -10,6 +10,27 @@ import { classMap } from "../../../utils/class-map.js";
|
|
|
10
10
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
11
11
|
const NS = 'email-template-form';
|
|
12
12
|
const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS))));
|
|
13
|
+
/**
|
|
14
|
+
* Form element for creating or editing email templates (`fx:email_template`).
|
|
15
|
+
*
|
|
16
|
+
* @slot description:before
|
|
17
|
+
* @slot description:after
|
|
18
|
+
*
|
|
19
|
+
* @slot content:before
|
|
20
|
+
* @slot content:after
|
|
21
|
+
*
|
|
22
|
+
* @slot timestamps:before
|
|
23
|
+
* @slot timestamps:after
|
|
24
|
+
*
|
|
25
|
+
* @slot create:before
|
|
26
|
+
* @slot create:after
|
|
27
|
+
*
|
|
28
|
+
* @slot delete:before
|
|
29
|
+
* @slot delete:after
|
|
30
|
+
*
|
|
31
|
+
* @element foxy-email-template-form
|
|
32
|
+
* @since 1.14.0
|
|
33
|
+
*/
|
|
13
34
|
export class EmailTemplateForm extends Base {
|
|
14
35
|
constructor() {
|
|
15
36
|
super(...arguments);
|