npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mageworx/giftcards-veniapwa

v1.1.0

Published

This add-on integrates [Gift Cards extension for Magento 2](https://www.mageworx.com/magento-2-gift-cards.html) using [MageWorx GiftCards GraphQl extension](https://repos.mageworx.com/mageworx_extensions_m2/gc/MageWorx_GiftCardsGraphQl) with [Magento 2 V

Downloads

1

Readme

MageWorx Gift Cards extension for Magento Venia PWA

This add-on integrates Gift Cards extension for Magento 2 using MageWorx GiftCards GraphQl extension with Magento 2 Venia PWA storefront.

Features

  • Add product type MageWorxGiftCards
  • Add fields to the gift card product page
  • Apply, remove gift cards from the cart
  • Check gift card balance on the cart page
  • Show gift cards summary amount on the cart page

Upload the extension

  1. Run yarn add @mageworx/giftcards-veniapwa or npm i @mageworx/giftcards-veniapwa in the root of your project.
  2. Open local-intercept.js in the root of your project and put this code into function localIntercept. Pay attention, function localIntercept must have targets as parameter (you can see example of local-intercept.js in @mageworx/giftcards-veniapwa/documentation).
/* MageWorx giftcards-veniapwa start */
const giftCardsTargetables = Targetables.using(targets);

const ProductDetails_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/ProductFullDetail/productFullDetail.js'
);
const GiftCardOptions = ProductDetails_giftCards.addImport("{GiftCardDetail} from '../../../../../@mageworx/giftcards-veniapwa/src/UI/templates/GiftCardDetail'");
ProductDetails_giftCards.insertAfterJSX(
    '<section className={classes.imageCarousel} />',
    `<${GiftCardOptions} className={classes.giftCardOptions} classes={ defaultClasses } giftCardAttributes={productDetails.giftCardAttributes} giftCardFormData={productDetails.giftCardFormData} />`
);

const Product_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/RootComponents/Product/product.js'
);
Product_giftCards.replaceJSX(
    '<ProductFullDetail product={product} />',
    `<ProductFullDetail product={product} classes={talonProps.classes}/>`
);

const PriceSummary_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/CartPage/PriceSummary/priceSummary.js'
);
const GiftCardSummaryMW = PriceSummary_giftCards.addImport("{GiftCardSummaryMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/molecules/GiftCardSummary'");
PriceSummary_giftCards.replaceJSX(
    '<GiftCardSummary/>',
    `<${GiftCardSummaryMW} classes={{lineItemLabel: classes.lineItemLabel, price: priceClass}} data={giftCards}/>`
);

const CartPriceAdjustments_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/CartPage/PriceAdjustments/priceAdjustments.js'
);
const CartGiftCardSectionMW = CartPriceAdjustments_giftCards.addImport("{GiftCardSectionMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/templates/GiftCardSection'");
CartPriceAdjustments_giftCards.replaceJSX(
    '<GiftCardSection/>',
    `<${CartGiftCardSectionMW} setIsCartUpdating={setIsCartUpdating}/>`
);

const CheckoutPriceAdjustments_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.js'
);
const CheckoutGiftCardSectionMW = CheckoutPriceAdjustments_giftCards.addImport("{GiftCardSectionMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/templates/GiftCardSection'");
CheckoutPriceAdjustments_giftCards.replaceJSX(
    '<GiftCardSection setIsCartUpdating={setPageIsUpdating} />',
    `<${CheckoutGiftCardSectionMW} setIsCartUpdating={setPageIsUpdating} />`
);

const MiniCartListingProduct_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/MiniCart/ProductList/item.js'
);
const GiftCardOptionsMW_MiniCartListing = MiniCartListingProduct_giftCards.addImport("{GiftCardOptionsMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/molecules/GiftCardOptions'");
MiniCartListingProduct_giftCards.insertAfterJSX(
    '<ProductOptions/>',
    `<${GiftCardOptionsMW_MiniCartListing} mail_to={props.mail_to} mail_from={props.mail_from} mail_to_email={props.mail_to_email} mail_message={props.mail_message} mail_delivery_date={props.mail_delivery_date} classes={{options: classes.options}} />`
);

const ProductListingProduct_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/CartPage/ProductListing/product.js'
);
const GiftCardOptionsMW_ProductListing = ProductListingProduct_giftCards.addImport("{GiftCardOptionsMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/molecules/GiftCardOptions'");
ProductListingProduct_giftCards.insertAfterJSX(
    '<ProductOptions/>',
    `<${GiftCardOptionsMW_ProductListing} mail_to={item.mail_to} mail_from={item.mail_from} mail_to_email={item.mail_to_email} mail_message={item.mail_message} mail_delivery_date={item.mail_delivery_date} classes={{options: classes.options, optionLabel: classes.optionLabel}} />`
);

const ItemsReviewItem_giftCards = giftCardsTargetables.reactComponent(
    '@magento/venia-ui/lib/components/CheckoutPage/ItemsReview/item.js'
);
const GiftCardOptionsMW_ItemsReview = ItemsReviewItem_giftCards.addImport("{GiftCardOptionsMW} from '../../../../../../@mageworx/giftcards-veniapwa/src/UI/molecules/GiftCardOptions'");
ItemsReviewItem_giftCards.insertAfterJSX(
    '<ProductOptions/>',
    `<${GiftCardOptionsMW_ItemsReview} mail_to={props.mail_to} mail_from={props.mail_from} mail_to_email={props.mail_to_email} mail_message={props.mail_message} mail_delivery_date={props.mail_delivery_date} classes={{options: classes.options}} />`
);

const graphqlItemsFragmentForGiftCards = '\t... on MageWorxGiftCardsCartItem {\n' +
    '\tmail_from\n' +
    '\tmail_to\n' +
    '\tmail_to_email\n' +
    '\tmail_message\n' +
    '\tmail_delivery_date\n' +
    '\t}\n';

const MiniCartProductListingGql_GiftCard = giftCardsTargetables.module(
    '@magento/peregrine/lib/talons/MiniCart/ProductList/productListFragments.gql.js'
);
MiniCartProductListingGql_GiftCard.insertAfterSource(
    'items {\n',
    graphqlItemsFragmentForGiftCards
);

const ProductListingGql_GiftCard = giftCardsTargetables.module(
    '@magento/peregrine/lib/talons/CartPage/ProductListing/productListingFragments.gql.js'
);
ProductListingGql_GiftCard.insertAfterSource(
    'items {\n',
    graphqlItemsFragmentForGiftCards
);

const ItemsReviewFragmentsGql_GiftCard = giftCardsTargetables.module(
    '@magento/peregrine/lib/talons/CheckoutPage/ItemsReview/itemsReviewFragments.gql.js'
);
ItemsReviewFragmentsGql_GiftCard.insertAfterSource(
    'items {\n',
    graphqlItemsFragmentForGiftCards
);
/* MageWorx giftcards-veniapwa end */
  1. Check that your local-intercept has this code before module.exports, if don't have you should add them (you can see example of local-intercept.js in @mageworx/giftcards-veniapwa/documentation)
const { Targetables } = require('@magento/pwa-buildpack');
  1. Create folder mageworx/configs/GiftCards in the root of your project. Copy config @mageworx/giftcards-veniapwa/documentation/date.locale.js from the package to created folder mageworx/configs/GiftCards.
  2. Let's run your project.
yarn watch

Localization of datepicker

You can add localizations that you need in mageworx/configs/GiftCards/date.locale.js, for example:

import { 
    enGB, 
    ru,
} from 'date-fns/locale'

export const dateLocale = [
    {
        name: "ru-RU",
        data: ru
    },
    {
        name: "en-GB",
        data: enGB
    },
]

Name has to be in ISO 639 format.