関数
Review::init()
Enqueues necessary assets for this View
戻り値 戻り値
ファイル: src/Views/ConfirmPageReview/Review.php
public function init() { parent::init(); $chargetype = 'once'; $amzproducttype = 'PayAndShip'; if (defined('WCEX_DLSELLER')) { if (!dlseller_have_shipped()) { $amzproducttype = 'PayOnly'; } } $opts = $this->module->getActingOpts(); // override Amazon address if Welcart address is preferred in settings $whichAddress = $opts['address_priority']; if ($whichAddress === 'welcart') { $amzproducttype = 'PayOnly'; } // components $this->childComponents = [ 'purchaseButton' => new VueComponentLoader( new ConfirmPurchaseButton($amzproducttype, $chargetype, 'welcart'), true ), ]; $this->amzProductType = strtolower($amzproducttype); // styles Theme::enqueueThemeCss(WCEXAAP_PLUGIN_URL); $semantic = new Semantic(); $semantic->loadMessageCss(); wp_enqueue_style( 'checkout_review', WCEXAAP_PLUGIN_URL . '/src/Views/ConfirmPageReview/Review.css', [], WCEXAAP_VERSION ); // scripts $deps = [Checkout::AMAZON_CHECKOUT_JS_SLUG]; $checkoutSessionId = isset($_REQUEST['amazonCheckoutSessionId']) ? $_REQUEST['amazonCheckoutSessionId'] : ''; $this->checkoutDetailsComp = new AmazonCheckoutDetails($this->module, $checkoutSessionId); if (!empty($this->checkoutDetailsComp->getAddressError())) { (new ChangeActions($this->module))->load( $this->checkoutDetailsComp->getCheckoutSessionId(), ['updateShippingAddressButton1', 'updateShippingAddressButton2'] ); $this->checkoutDetailsComp->loadAddressErrorMessageBoxCss(); $deps[] = ChangeActions::WCEXAAP_CHANGE_ACTIONS_JS_SLUG; } else { wp_enqueue_script( Checkout::AMAZON_CHECKOUT_JS_SLUG, $opts['amzjsurl'] . '/checkout.js', [], WCEXAAP_VERSION, true ); } wp_enqueue_script( 'wcexaap-welcart-checkout-review', WCEXAAP_PLUGIN_URL . '/dist/confirmPage.js', $deps, WCEXAAP_VERSION, true ); // script vars $jsvars = []; $jsvars['childComponents'] = $this->childComponents; $jsvars['payAndShip'] = $amzproducttype === 'PayAndShip'; $jsvars['checkoutSessionId'] = $checkoutSessionId; $jsvars['addressError'] = $this->checkoutDetailsComp->getAddressError(); $jsvars = array_merge($jsvars, $this->module->getScriptInjectionVariables()); wp_localize_script('wcexaap-welcart-checkout-review', AmazonPay::L10N, $jsvars); return $this; }