pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[feature]: TalonWrapper needs Component injection

Open fooman opened this issue 5 years ago • 5 comments

Is your feature request related to a problem? Please describe. The extension points are currently limited when trying to inject additional content/components.

Describe the solution you'd like Currently for the useProductFullDetails we can wrap this function

    const talonProps = useProductFullDetail({
        addConfigurableProductToCartMutation: ADD_CONFIGURABLE_MUTATION,
        addSimpleProductToCartMutation: ADD_SIMPLE_MUTATION,
        createCartMutation: CREATE_CART_MUTATION,
        getCartDetailsQuery: GET_CART_DETAILS_QUERY,
        product
    });

unfortunately it is a bit of dead end if we want to have additional content rendered. Consider trying to for example add a video component into the below:

    return (
        <Fragment>
            {breadcrumbs}
            <Form className={classes.root}>
[...]
            </Form>
        </Fragment>

there doesn't seem to be an option to get from the talon prop into the Fragment. Ideally we would have something like

    const {
        breadcrumbCategoryId,
        handleAddToCart,
        handleSelectionChange,
        handleSetQuantity,
        isAddToCartDisabled,
        mediaGalleryEntries,
        productDetails,
        quantity,
        extraContentStart,
        extraContentEnd,
        extraFormContent
    } = talonProps;
    return (
        <Fragment>
            {extraContentStart}
            {breadcrumbs}
            <Form className={classes.root}>
[...]
                        {extraFormContent}
            </Form>
            {extraContentEnd}
        </Fragment>

Describe alternatives you've considered An alternative could be to create an additional venia-ui target for productFullDetail.

Please let us know what packages this feature is in regards to:

  • [ ] venia-concept
  • [x] venia-ui
  • [ ] pwa-buildpack
  • [x] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

fooman avatar Jul 01 '20 23:07 fooman

Hi @fooman. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Jul 01 '20 23:07 m2-assistant[bot]

This might be related with https://github.com/magento/pwa-studio/issues/2281

Jordaneisenburger avatar Jul 03 '20 11:07 Jordaneisenburger

@Jordaneisenburger Definitely related. I see #2281 as the use case where one is already customising venia-ui. The above would be trying to inject content completely via a separate package without the need to customise venia-ui nor peregrine.

fooman avatar Jul 03 '20 11:07 fooman

@magento export issue to JIRA project PWA as Story

sirugh avatar May 17 '21 21:05 sirugh

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-1773 is successfully created for this GitHub issue.

github-jira-sync-bot avatar May 17 '21 21:05 github-jira-sync-bot