From 6f0c45b74eafbcf688395cd26db21d43e7b243d4 Mon Sep 17 00:00:00 2001 From: Nicola Sacco Date: Tue, 15 Oct 2024 17:30:27 +0200 Subject: [PATCH] Customisation: Toggle product description from the product info panel (#212) --- src/stories/fixtures.ts | 5 +- .../state-present-offer.stories.svelte | 10 ++ src/ui/rcb-ui.svelte | 1 + src/ui/states/state-present-offer.svelte | 94 +++++++++++-------- 4 files changed, 70 insertions(+), 40 deletions(-) diff --git a/src/stories/fixtures.ts b/src/stories/fixtures.ts index ca725377..861d1b58 100644 --- a/src/stories/fixtures.ts +++ b/src/stories/fixtures.ts @@ -29,7 +29,9 @@ export const subscriptionOption: SubscriptionOption = { export const product: Product = { identifier: "some_product_123", displayName: "Some Product 123", - description: "a very nice product", + description: + "This is a long description of the product which is long. " + + "It is long indeed so that it spans multiple lines.", title: "Some Product 123", productType: ProductType.Subscription, @@ -84,5 +86,4 @@ export const colorfulBrandingAppearance = { color_product_info_bg: "#ffffff", color_buttons_primary: "#AC7DE3", color_accent: "#99BB37", - show_product_description: true, }; diff --git a/src/stories/state-present-offer.stories.svelte b/src/stories/state-present-offer.stories.svelte index f8a4d23f..91c1913e 100644 --- a/src/stories/state-present-offer.stories.svelte +++ b/src/stories/state-present-offer.stories.svelte @@ -60,5 +60,15 @@ + + + + + + + \ No newline at end of file diff --git a/src/ui/rcb-ui.svelte b/src/ui/rcb-ui.svelte index 10a11446..e8f43494 100644 --- a/src/ui/rcb-ui.svelte +++ b/src/ui/rcb-ui.svelte @@ -205,6 +205,7 @@ {#if productDetails && purchaseOptionToUse} {/if} diff --git a/src/ui/states/state-present-offer.svelte b/src/ui/states/state-present-offer.svelte index f393cc38..9ae95c62 100644 --- a/src/ui/states/state-present-offer.svelte +++ b/src/ui/states/state-present-offer.svelte @@ -1,59 +1,67 @@ -
- {productDetails.title} +
+ {productDetails.title} - {#if isSubscription} + {#if isSubscription} {#if subscriptionTrial?.periodDuration} {getTrialsLabel(subscriptionTrial.periodDuration)} free trial {/if} - {#if !subscriptionTrial?.periodDuration && subscriptionBasePrice } + {#if !subscriptionTrial?.periodDuration && subscriptionBasePrice } {subscriptionBasePrice.formattedPrice} {/if} - {#if (subscriptionTrial && subscriptionBasePrice)} + {#if (subscriptionTrial && subscriptionBasePrice)} {subscriptionTrial && subscriptionBasePrice && `${ subscriptionBasePrice.formattedPrice} after end of trial`} - {/if} -
    - {#if productDetails.normalPeriodDuration} -
  • Renews {getRenewsLabel(productDetails.normalPeriodDuration)}
  • - {/if} -
  • Continues until canceled
  • -
  • Cancel anytime
  • -
+ {/if} + {#if brandingAppearance?.show_product_description && productDetails.description} + {productDetails.description} + {/if} +
    + {#if productDetails.normalPeriodDuration} +
  • Renews {getRenewsLabel(productDetails.normalPeriodDuration)}
  • {/if} - {#if !isSubscription} - {nonSubscriptionBasePrice?.formattedPrice} - {/if} -
+
  • Continues until canceled
  • +
  • Cancel anytime
  • + + {/if} + {#if !isSubscription} + {nonSubscriptionBasePrice?.formattedPrice} + {#if brandingAppearance?.show_product_description} + {productDetails.description} + {/if} + {/if} + +