2023-09-07 09:56:46 +02:00
|
|
|
import SingleProductHandler from "./SingleProductHandler";
|
|
|
|
import CartHandler from "./CartHandler";
|
|
|
|
import CheckoutHandler from "./CheckoutHandler";
|
|
|
|
import CartBlockHandler from "./CartBlockHandler";
|
|
|
|
import CheckoutBlockHandler from "./CheckoutBlockHandler";
|
|
|
|
import MiniCartHandler from "./MiniCartHandler";
|
2023-11-03 10:30:31 +00:00
|
|
|
import PreviewHandler from "./PreviewHandler";
|
2023-10-31 10:35:29 +00:00
|
|
|
import PayNowHandler from "./PayNowHandler";
|
2023-09-07 09:56:46 +02:00
|
|
|
|
|
|
|
class ContextHandlerFactory {
|
|
|
|
|
|
|
|
static create(context, buttonConfig, ppcpConfig) {
|
|
|
|
switch (context) {
|
|
|
|
case 'product':
|
|
|
|
return new SingleProductHandler(buttonConfig, ppcpConfig);
|
|
|
|
case 'cart':
|
|
|
|
return new CartHandler(buttonConfig, ppcpConfig);
|
|
|
|
case 'checkout':
|
|
|
|
return new CheckoutHandler(buttonConfig, ppcpConfig);
|
2023-10-31 10:35:29 +00:00
|
|
|
case 'pay-now':
|
|
|
|
return new PayNowHandler(buttonConfig, ppcpConfig);
|
2023-09-07 09:56:46 +02:00
|
|
|
case 'mini-cart':
|
|
|
|
return new MiniCartHandler(buttonConfig, ppcpConfig);
|
|
|
|
case 'cart-block':
|
|
|
|
return new CartBlockHandler(buttonConfig, ppcpConfig);
|
|
|
|
case 'checkout-block':
|
|
|
|
return new CheckoutBlockHandler(buttonConfig, ppcpConfig);
|
2023-11-03 10:30:31 +00:00
|
|
|
case 'preview':
|
|
|
|
return new PreviewHandler(buttonConfig, ppcpConfig);
|
2023-09-07 09:56:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ContextHandlerFactory;
|