-
Notifications
You must be signed in to change notification settings - Fork 3
/
intercept.js
40 lines (35 loc) · 1.42 KB
/
intercept.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module.exports = (targets) => {
const peregrineTargets = targets.of("@magento/peregrine");
const talonsTarget = peregrineTargets.talons;
talonsTarget.tap(talons => {
talons.CheckoutPage.useCheckoutPage.wrapWith('@vipps/module-payment/src/targets/useCheckoutPageWrapper');
});
const { specialFeatures } = targets.of("@magento/pwa-buildpack");
/**
* Wee need to activate esModules, cssModules and GQL Queries to allow build pack to load our extension
* {@link https://magento.github.io/pwa-studio/pwa-buildpack/reference/configure-webpack/#special-flags}.
*/
specialFeatures.tap((flags) => {
flags[targets.name] = {
esModules: true,
cssModules: true,
graphqlQueries: true,
};
});
/** Registers our Payment **/
const { checkoutPagePaymentTypes } = targets.of("@magento/venia-ui");
checkoutPagePaymentTypes.tap((payments) =>
payments.add({
paymentCode: "vipps",
importPath: "@vipps/module-payment/src/components/vipps.payment.js",
})
);
targets.of("@magento/venia-ui").routes.tap((routes) => {
routes.push({
name: "VippsPaymentFallback",
pattern: "/vipps/payment/fallback",
path: require.resolve("./src/components/ConfirmationPage/confirmationPage.js"),
});
return routes;
});
};