@akinon/pz-b2b

1.32.0 • Public • Published

pz-b2b

Install the npm package

# For latest version
yarn add git+ssh://git@bitbucket.org:akinonteam/pz-b2b.git

# For specific version
yarn add git+ssh://git@bitbucket.org:akinonteam/pz-b2b.git#xxxxxxx

Installation

File Path: src/routes/index.ts

Add ACCOUNT_MY_QUOTATIONS route into ACCOUNT_ROUTES

enum ACCOUNT_ROUTES {
  ...,
  ACCOUNT_MY_QUOTATIONS = '/users/my-quotations'
}
File Path: src/views/account/account-menu.tsx

Add my quotes link to account menu

const ACCOUNT_MENU_ITEMS = [
  ...,
  {
    translationKey: 'account.base.menu.my_quotations',
    href: ROUTES.ACCOUNT_MY_QUOTATIONS,
    testId: 'account-my-quotations'
  }
];
File Path: public/locales/en/account.json
File Path: public/locales/tr/account.json

Add translation to account.base.menu. Apply this for every language

 "my_quotations": "My Quotations"
 "my_quotations": "Tüm Tekliflerim"
File Path: public/locales/en/product.json
File Path: public/locales/tr/product.json

Add the translation inside the product object. Apply this for every language

"store_select_modal": {
  "title": "CHOOSE STORE",
  "store_name": "STORE NAME",
  "quantity": "QUANTITY",
  "add_to_basket": "Add to Basket",
  "valid_quantity": "Please select a store and enter a valid quantity"
}

"store_select_modal": {
  "title": "MAĞAZA SEÇ",
  "store_name": "MAĞAZA ADI",
  "quantity": "ADET",
  "add_to_basket": "SEPETE EKLE",
  "valid_quantity": "Lütfen bir mağaza seçin ve geçerli bir miktar girin"
}
File Path: public/locales/en/basket.json
File Path: public/locales/tr/basket.json

Add the translation inside the basket object. Apply this for every language

"b2b": {
    "my_cart": "My Cart",
    "back_to_shopping": "BACK TO SHOPPING",
    "save_cart": "SAVE CART",
    "request_quote": "REQUEST A QUOTE",
    "total_price": "Catalog Total Price (Excl. Tax)",
    "save_cart_modal": {
      "title": "SAVE CART",
      "cart_name": "Cart Name",
      "save_cart_button": "SAVE CART"
    },
    "request_quote_modal": {
      "title": "REQUEST A QUOTE",
      "quotation_name": "Quotation Name",
      "button": "SAVE"
    },
    "remove_product_modal": {
      "title": "DELETE AND ADD TO FAVORITES",
      "description": "Would you like to add this product you want to delete to your favorites?",
      "add_to_favorites_button": "ADD TO FAVORITES",
      "delete_product_button": "delete product"
    },
    "empty": {
      "title": "Your cart is empty, would you like to continue with your saved carts?",
      "button": "SELECT CART",
      "choose_cart_placeholder": "Chose a cart"
    },
    "table": {
      "basket_qty": "<Qty /> Products",
      "delete": "Delete",
      "name_sku": "NAME & SKU",
      "price": "PRICE",
      "quantity": "QTY",
      "store_name": "STORE NAME",
      "store_qty": "STORE QTY",
      "subtotal": "SUBTOTAL"
    }
  }

"b2b": {
    "my_cart": "Sepetim",
    "back_to_shopping": "ALIŞVERİŞE GERİ DÖN",
    "save_cart": "SEPETİ KAYDET",
    "request_quote": "TEKLİF İSTE",
    "total_price": "Katalog Toplam Fiyatı (Vergi Hariç)",
    "save_cart_modal": {
      "title": "SEPETİ KAYDET",
      "cart_name": "Sepet Adı",
      "save_cart_button": "SEPETİ KAYDET"
    },
    "request_quote_modal": {
      "title": "TEKLİF İSTE",
      "quotation_name": "Teklif Adı",
      "button": "KAYDET"
    },
    "remove_product_modal": {
      "title": "SİL VE FAVORİLERE EKLE",
      "description": "Silmek istediğiniz bu ürünü favorilerinize eklemek ister misiniz?",
      "add_to_favorites_button": "FAVORİLERE EKLE",
      "delete_product_button": "ürünü sil"
    },
    "empty": {
      "title": "Sepetiniz boş, kaydettiğiniz sepetlerle devam etmek ister misiniz?",
      "button": "SEPETİ SEÇ",
      "choose_cart_placeholder": "Bir sepet seçin"
    },
    "table": {
      "basket_qty": "<Qty /> Ürün",
      "delete": "Sil",
      "name_sku": "AD & SKU",
      "price": "FİYAT",
      "quantity": "ADET",
      "store_name": "MAĞAZA ADI",
      "store_qty": "MAĞAZA ADEDİ",
      "subtotal": "ARA TOPLAM"
    }
  }
File Path: src/settings.js

Update destination path for basket route

rewrites: [
  {
    source: ROUTES.BASKET,
    destination: '/basket-b2b'
  }
],

Add rewrite url

rewrites: [
  ...,
  {
    source: ROUTES.ACCOUNT_MY_QUOTATIONS,
    destination: '/account/my-quotations'
  }
],
File Path: src/plugins.js

Add plugin name

module.exports = ["...", "pz-b2b"];
File Path: src/views/product/product-info.tsx

Add imports

import { useB2b, StoreModal } from "@akinon/pz-b2b";

Add useB2b hook

const {
  openSelectStoreModal,
  setOpenSelectStoreModal,
  divisions,
  divisionLoading,
  B2bButton,
} = useB2b();

Add open modal button

<B2bButton buttonText={t("product.add_to_cart")} />

Add the end in the return

{
  !divisionLoading && (
    <StoreModal
      storeData={divisions}
      productPk={data.product.pk}
      open={openSelectStoreModal}
      setOpen={setOpenSelectStoreModal}
    />
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @akinon/pz-b2b

Weekly Downloads

327

Version

1.32.0

License

MIT

Unpacked Size

56.3 kB

Total Files

16

Last publish

Collaborators

  • akinon