magento / pwa-studio

šŸ› Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[feature]: TalonWrapper needs Component injection #2521

Open fooman opened 4 years ago

fooman commented 4 years ago

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:

m2-assistant[bot] commented 4 years ago

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


Jordaneisenburger commented 4 years ago

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

fooman commented 4 years ago

@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.

sirugh commented 3 years ago

@magento export issue to JIRA project PWA as Story

github-jira-sync-bot commented 3 years ago

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