投稿時間:2022-06-28 21:22:31 RSSフィード2022-06-28 21:00 分まとめ(25件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] 政府の「節電ポイント」は8月開始か 電力会社の節電プログラムに参加する家庭にまず2000円相当 https://www.itmedia.co.jp/news/articles/2206/28/news213.html itmedia 2022-06-28 20:20:00
js JavaScriptタグが付けられた新着投稿 - Qiita 複数のファイルに分割されて定義された prototype の function をまとめて import する https://qiita.com/mml/items/d20d9ba43993049207c2 function 2022-06-28 20:09:03
海外TECH MakeUseOf Amazon Prime Day Early Deal: Save $30 on Fire HD & Luna Gaming Bundles https://www.makeuseof.com/amazon-prime-day-fire-hd-luna-bundle/ Amazon Prime Day Early Deal Save on Fire HD amp Luna Gaming BundlesEarly deals are rolling in and the Fire HD tablets are getting bundled with the Luna controller for those who want to start gaming 2022-06-28 11:35:14
海外TECH MakeUseOf 4 Things To Do if Your Laptop's Hinge Just Broke https://www.makeuseof.com/things-to-do-laptops-hinge-broke/ Things To Do if Your Laptop x s Hinge Just BrokeThere s life beyond your laptop s hinge It might seem like everything is lost if your laptop breaks but luckily there s a few things you can do 2022-06-28 11:30:13
海外TECH MakeUseOf The 7 Best Dell 4K Monitors https://www.makeuseof.com/best-dell-4k-monitors/ investment 2022-06-28 11:15:13
海外TECH DEV Community [Challenge] Add numbers without (+-*/) https://dev.to/nombrekeff/challenge-add-numbers-without--3mac Challenge Add numbers without Time for another casual little challenge For this one there are only rules you must add numbers a and b togetheryou must NOT use the operatorsApart from that there are no more rules and can be done with any language you want Pseudocode a b add a b gt Test add a b a bHave fun Let s see what you come up with 2022-06-28 11:32:05
海外TECH DEV Community Choosing an OpenTelemetry backend - Things to keep in mind https://dev.to/signoz/choosing-an-opentelemetry-backend-things-to-keep-in-mind-23ao Choosing an OpenTelemetry backend Things to keep in mindOpenTelemetry is a Cloud Native Computing Foundation CNCF incubating project aimed at standardizing the way we instrument applications for generating telemetry data logs metrics and traces However OpenTelemetry does not provide storage and visualization for the collected telemetry data And that s where an OpenTelemetry backend is needed Cloud computing and containerization made deploying and scaling applications easier Modern applications make use of modular code and architectures like microservices and serverless Engineering teams can ship features faster and any surge in user demand can be met by just spinning up more containers But every coin has two sides While having benefits like smaller engineering teams and on demand scaling of applications cloud computing and containerization have also increased operational complexity manifolds Troubleshooting an application based on a distributed system for performance issues is like finding a needle in a haystack Collecting data from applications that can act as signals for troubleshooting performance issues is a practice as old as writing software The data that helps to analyze performance issues is known as telemetry data For cloud native applications it became a challenge to have a consistent framework for generating telemetry data OpenTelemetry solves this problem by creating an open standard for generating telemetry data Let s learn a bit about OpenTelemetry What is OpenTelemetry OpenTelemetry is an open source collection of tools APIs and SDKs that aims to standardize the way we generate and collect telemetry data It follows a specification driven development The OpenTelemetry specification has design and implementation guidelines for how the instrumentation libraries should be implemented In addition it provides client libraries in all the major programming languages which follow the specification OpenTelemetry was formed after the merger of two open source projects OpenCensus and OpenTracing in Since then it has been the go to open source standard for instrumenting cloud native applications The specification is designed into distinct types of telemetry known as signals Presently OpenTelemetry has specifications for these three signals Logs Metrics andTracesTogether these three signals form the three pillars of observability OpenTelemetry is the bedrock for setting up an observability framework The application code is instrumented using OpenTelemetry client libraries which enables the generation of telemetry data Once the telemetry data is generated and collected OpenTelemetry needs a backend analysis tool to which it can send the data Why does OpenTelemetry need a backend The founders of OpenTelemetry wanted to standardize two things The way we instrument application codeThe data format of generated telemetry dataOnce we have the telemetry data in a consistent format it can be sent to any observability backend This provides users the freedom to select any OpenTelemetry backend based on their observability needs The aim of OpenTelemetry was always to have a pluggable architecture using which users can build robust observability stacks using additional technology protocols and formats Here s a snapshot showing how OpenTelemetry fits within a microservice based application and an observability backend How OpenTelemetry fits within a microservice based application and an observability backend SigNozThe OpenTelemetry collector acts as the routing layer Once the telemetry data is collected with the help of OpenTelemetry libraries it is sent to the OpenTelemetry collector The OpenTelemetry collector can export the telemetry data in multiple formats to multiple observability backends Things to look out for when choosing an OpenTelemetry backendOpenTelemetry provides you the freedom to choose a backend analysis tool of your choice Most observability vendors currently have introduced support for OpenTelemetry So how do you ensure which OpenTelemetry backend to go for There are three main components that an OpenTelemetry backend is responsible for Data StorageObservability data can be huge The data storage of an OpenTelemetry backend should be highly scalable and query execution performance should be top notch Query ServiceOpenTelemetry has three distinct signals Each signal has different data formats with different use cases for users Moreover the signals are correlated The query service of an OpenTelemetry backend should be built with these considerations in mind VisualizationMaking sense out of data is what impacts the end user of observability dashboards OpenTelemetry backends should provide intuitive dashboards that enable end users to take quick actions on performance issues Below is the list of factors that should be taken into consideration before selecting an OpenTelemetry backend Support for all distinct signals of OpenTelemetryCurrently OpenTelemetry collects telemetry data in three distinct signals namely logs metrics and traces Setting up a robust observability framework requires the use of all three signals An OpenTelemetry backend should be able to ingest and visualize all three signals Moreover the frontend of the OpenTelemetry backend should also provide features to easily correlate the signals Native support for OpenTelemetry semantic conventionsIn OpenTelemetry every component of a distributed system is defined as an attribute The attribute is nothing but a key value pair These attributes are defined by the OpenTelemetry specification as OpenTelemetry semantic conventions For example here is a glimpse of how HTTP conventions look like AttributeDescriptionExamplehttp methodHTTP request methodGET POST HEADhttp targetThe full request target as passed in an HTTP request line or equivalent blog june http schemeThe URI scheme that identifies the used protocolhttp httpsAn OpenTelemetry backend should have native support to store data with OpenTelemetry semantic conventions Existing observability vendors usually transform the data collected using OpenTelemetry semantic conventions into their propriety formats But OpenTelemetry has a huge list of semantic conventions which might not be fully utilized in such scenarios Should allow aggregates on trace dataRunning aggregates on trace data enables you to create service centric views OpenTelemetry also provides you the ability to create custom tags Combined with custom tags and aggregated trace data gives you a powerful magnifying glass to surface performance issues in your services For example you can get the error rate and th percentile latency of customer type gold or deployment version v or external call paypalOpen SourceOpenTelemetry is an open source standard with a huge community backing It is testimonial to the fact that community driven projects can solve large complex engineering problems It is not necessary for the OpenTelemetry backend to be open source But having an open source OpenTelemetry backend can enable you to have a full stack open source solution Open source solutions have more flexibility and if you self host you don t need to worry about things like data privacy Nearly all observability vendors now claim to be compatible with OpenTelemetry But it s difficult to move away from legacy systems A solution built natively for OpenTelemetry can be a good choice for an OpenTelemetry backend And that s where SigNoz comes into the picture Trying out an OpenTelemetry BackendIf you want to play around with an OpenTelemetry backend it is easy to get started with SigNoz SigNoz is an open source APM built natively on OpenTelemetry SigNoz can be installed on macOS or Linux computers in just three steps by using a simple installation script The install script automatically installs Docker Engine on Linux However you must manually install Docker Engine on macOS before running the install script git clone b main https github com SigNoz signoz gitcd signoz deploy install shYou can visit our documentation for instructions on how to install SigNoz using Docker Swarm and Helm Charts Once your application is instrumented with OpenTelemetry client libraries the data can be sent to the SigNoz backend by specifying a specific port on the machine where SigNoz is installed You can then use Signoz to monitor application metrics with out of box charts and visualization An OpenTelemetry backend built natively for OpenTelemetry SigNoz provides out of box charts for application metricsThe tracing signal from OpenTelemetry instrumentation helps you correlate events across services With SigNoz you can visualize your tracing data using Flamegraphs and Gantt charts It shows you a complete breakdown of the request along with every bit of data collected with OpenTelemetry semantic conventions Tracing data collected by OpenTelemetry can be visualized with the help of Flamegraphs and Gantt charts on the SigNoz dashboardSigNoz also lets you run aggregates on your tracing data Running aggregates on tracing data enables you to create service centric views providing insights to debug applications at the service level It also makes sense for engineering teams as they own specific microservices Running aggregates on your tracing data enables you to create service centric viewsYou can check out the SigNoz GitHub repo here Further ReadingSigNoz an open source alternative to DataDogOpenTelemetry Collector a complete guide 2022-06-28 11:27:40
海外TECH DEV Community Medusa + Nuxt.js + Stripe - How to Create a Nuxt.js Ecommerce Storefront from Scratch Using Medusa Part 3 https://dev.to/medusajs/medusa-nuxtjs-stripe-how-to-create-a-nuxtjs-ecommerce-storefront-from-scratch-using-medusa-part-3-3jg0 Medusa Nuxt js Stripe How to Create a Nuxt js Ecommerce Storefront from Scratch Using Medusa Part IntroductionMedusa is an open source headless commerce that allows you to build online stores through its APIs with just a few commands One of its key features is the ease to integrate different payment providers to accept payments when customers place their orders In the second part of this series you added the cart functionality to your Nuxt js storefront Following from there in this guide you will learn how to integrate and use Stripe as a payment provider to allow customers to make payments and place orders You can find the code of this tutorial at this GitHub repository PrerequisitesTo follow along with this tutorial you need the following A Medusa server with some dummy data to work with If you don t have one you can follow the QuickStart guide to install one An admin dashboard to manage your ecommerce store Medusa provides an intuitively designed admin dashboard that you can use The Nuxt js storefront from the second part of the series You can clone the part cart flow branch of this GitHub repository and continue on from there A Stripe account to retrieve the API Keys and secrets to connect your Medusa server with Stripe The account should be in sandbox mode to test out the integration Medusa Server SetupThis section guides you over the steps necessary to add Stripe as a payment provider to your Medusa server Install Stripe PluginGo to your Medusa server directory with cd medusa server and in the root of the project install the Stripe plugin with the following command yarn add medusa payment stripe Stripe Plugin ConfigurationOnce the plugin is installed you need to add configurations for it Open your medusa config js file and look for the plugins section Then add the following object to the plugins array const plugins resolve medusa payment stripe options api key process env STRIPE API KEY webhook secret process env STRIPE WEBHOOK SECRET Where STRIPE API KEY is the Secret key from Stripe you can retrieve it from Stripe s dashboard by click on the Developers link at the top right then choosing API Keys from the left sidebar and copying the Secret key Next you need to add the secret key to your environment variables In your Medusa server open your  env file and add the Stripe key STRIPE API KEY sk test KALKSDLKKMKCDJNJ ️Later on you will come back to stripe s dashboard to copy the Publishable key and add it to the Nuxt js storefront Admin Dashboard SetupTo use Stripe as a payment provider in your storefront you must add it as a payment provider in a region first This section guides you in how to do that using Medusa s Admin Dashboard Add Stripe to a RegionMake sure your Medusa server is running Then start your admin panel with yarn run develop It should run on localhost by default Open the Admin dashboard in your browser log in and click on Settings in the sidebar Then choose Regions Next for every region you want to add Stripe as a payment provider in scroll down the form on the right to Payment Providers and choose Stripe Then click Save ️This set up is very important If the region doesn t have Stripe as a payment provider it will not be available on the storefront Storefront Set UpIn this section you ll learn more about Medusa s checkout flow and how to integrate Stripe as a payment provider Workflow OverviewIn a nutshell the workflow the Nuxt js storefront has to follow to implement a full checkout workflow When the user visits the website an empty cart is created on the Medusa server with a default region and country code During checkout the user fills up a form with their email and shipping address The user chooses a fulfillment provider for the shipping method The user chooses a payment provider and fills any necessary information such as credit card details If the payment is processed successfully the order is placed At each of these steps the cart is updated on the server with new information based on what the user chooses Install Nuxt js Stripe ModuleBefore you start the stripe implementation you need to install a Nuxt js module to help you with that You ll be using Nuxt stripe module to handle the payment confirmation with stripe In the directory of your Nuxt js storefront run the following command yarn add nuxt stripe moduleAfter the installation is complete open nuxt config js and add nuxt stripe module to the modules section with the publishable key passed as an option modules nuxt stripe module publishableKey process env PUBLISHABLE KEY Next go back to the Stripe developer dashboard and copy the publishable key from the API keys page Then create a  env file in the root directory of the project if it doesn t already exist and add the publishable key PUBLISHABLE KEY lt YOUR PUBLISHABLE KEY gt Where lt YOUR PUBLISHABLE KEY gt is the key you copied Add Checkout PageOnce the Stripe module is added to the Nuxt js storefront the next step is to add the checkout page and its components to actually be able to use it Create the file pages checkout index vue with the following content lt template gt lt div class bg ui gt lt div class container mx auto p relative gt lt div class layout base gt lt div class flex flex col reverse lg flex row gt lt div class lg w gt lt checkout flow gt lt div gt lt div class lg w lg pl gt lt checkout summary gt lt div gt lt div gt lt div gt lt div gt lt div gt lt template gt lt script gt export default name Checkout lt script gt This is the Checkout page It loads the lt checkout flow gt component that is in charge of all the checkout process It also loads the lt checkout summary gt component that shows to the user a cart s summary with the products in it and the totals of their cart including shipping and taxes amounts Add Checkout ComponentsCreate the file components Totals vue with the following content lt template gt lt div class my border t bt gray gt lt div class font light text sm space y mt gt lt div class flex items center justify between mb gt lt p gt Subtotal lt p gt lt p class font medium gt formatPrice item subtotal currencyCode lt p gt lt div gt lt div v if item shipping total class flex items center justify between mb gt lt p gt Shipping lt p gt lt p class font medium gt formatPrice item shipping total currencyCode lt p gt lt div gt lt div class flex items center justify between mb gt lt p gt Taxes lt p gt lt p class font medium gt formatPrice item tax total currencyCode lt p gt lt div gt lt div class h px w full bg ui medium mb gt lt div class flex items center justify between gt lt p gt Total lt p gt lt p class font medium gt formatPrice item total currencyCode lt p gt lt div gt lt div gt lt div gt lt template gt lt script gt import formatPrice from utils format price export default name Totals props item type Object default return computed currencyCode return this item currency code this store getters cart cartCurrencyCode methods formatPrice lt script gt This component is used to display the totals for the customer It can be used in multiple places such as the checkout or order summary pages Next create the file components Checkout Item vue with the following content lt template gt lt div class flex gt lt div class bg ui rounded md overflow hidden mr max w gt lt img class h auto w full object cover src item thumbnail alt item title gt lt div gt lt div class flex justify between w full text sm py gt lt div class flex flex col justify between gt lt div gt lt p class font semibold mb gt item title lt p gt lt p gt Variant item description lt p gt lt div gt lt div gt lt p class mb gt Quantity item quantity lt p gt lt p class font medium gt Total formatPrice item unit price cartCurrencyCode item quantity lt p gt lt div gt lt div gt lt div gt lt p class font medium gt formatPrice item unit price cartCurrencyCode lt p gt lt div gt lt div gt lt div gt lt template gt lt script gt import mapGetters from vuex import formatPrice from utils format price export default name CartItem props item type Object default return computed mapGetters cartCurrencyCode cart cartCurrencyCode methods formatPrice lt script gt This component is used to render each product that is added to the cart It shows basic information as the product s title description quantity and price Next create the file components Checkout Summary vue with the following content lt template gt lt div class flex w full flex col lg relative bg white mb lg mb rounded lg shadow py px max h review overflow hidden gt lt div class flex grow overflow y scroll gt lt checkout item v for item in items key item id item item class mb last mb gt lt div gt lt totals item store state cart cart gt lt div gt lt template gt lt script gt import mapGetters from vuex export default name CheckoutSummary computed mapGetters items cart items lt script gt The lt checkout summary gt component uses the two previous components to show the items in the cart and the cart totals For the lt checkout flow gt component you ll create a placeholder component for now Create the file components Checkout Flow vue with the following content lt template gt lt div class flex flex col gt Section for checkout flow lt div gt lt template gt lt script gt export default name CheckoutFlow lt script gt Next open the components Dropdowns CartPopover vue and replace the “Checkout button with the following content lt nuxt link to checkout gt lt button class btn ui font medium px py mb text sm w full gt Checkout lt button gt lt nuxt link gt Now when the customer clicks on the “Checkout button in the cart popover they are taken to the Checkout page Test it OutMake sure your Medusa server is running Then run your Nuxt js storefront yarn run devOnce the storefront is running go to the products page on http localhost products and add a few products to your cart Then at the top right click on the bag icon to see the cart popover Click on the “Checkout button You ll be taken to the checkout page which shows the Summary and Flow components you created earlier Set Up Checkout FlowIn this part you will go through the steps needed to implement the checkout flow in your Nuxt js storefront including the step related to adding a custom payment provider To complete the checkout the customer has to follow and complete four main steps Give their email address Fill up a form with their shipping address Choose a shipping option Choose a payment method to complete their purchase Each of these steps will become a component of their own and they will be rendered in the checkout flow component Wrapper ComponentsCreate the file components Checkout Step vue with the following content lt template gt lt div class text left mb last mb w full gt lt div class bg white rounded lg p shadow gt lt div class w full gt lt div class flex items center justify between w full gt lt h class font bold gt title lt h gt lt checkout check icon v if showSuccessIcon class bg green gt lt div gt lt div gt lt slot gt lt div gt lt div gt lt template gt lt script gt export default name CheckoutStep props showSuccessIcon type Boolean default false title type String default Title lt script gt This component is the wrapper component for each of the components specific in each step It has only two props one for the title and the other one to show a success icon once that step has been completed Next create the file components Checkout CheckIcon vue with the following content lt template gt lt span class rounded xl flex bg green items center justify center class w size h size gt lt svg class w size h size fill ffffff version xmlns xmlns xlink viewBox xml space preserve gt lt path d M c L c L c c l c c l C z gt lt svg gt lt span gt lt template gt lt script gt export default name CheckIcon props size type Number default lt script gt This component just displays a check SVG icon Form Input ComponentsBefore you create the components for each of the steps you need to install a package to help you manage form inputs Run the following command to install the vue formulate package yarn add braid vue formulateThen update the build modules property in your nuxt confg js file to include the package export default buildModules braid vue formulate nuxt You also need to install sass to override some style for the form inputs that you will use later So run the following command to install it yarn add dev sass sass loader Contact ComponentThis component is the simplest of the four Here the customer has to write their email address Then the email will be validated and if everything is valid the customer can go to the next step First you have to add a new state and a new mutation to the cart store Open the store cart js file and update the state function and the mutations as the following export const state gt cart email null export const mutations SET CART state cart SET CART EMAIL state email state email email You can now save the customer s email to the store and retrieve it later whenever necessary Next create the file components Checkout Steps Contact vue with the following content lt template gt lt checkout step title Contact show success icon isCompleted gt lt FormulateForm v show isOpen v slot hasErrors class mt submit submitHandler gt lt FormulateInput type email label Email name email class w full validation bail required email gt lt div class flex items center justify end mt gt lt FormulateInput type submit label Next disabled hasErrors input class btn ui gt lt div gt lt FormulateForm gt lt checkout step gt lt template gt lt script gt export default name Contact props isCompleted type Boolean default false isOpen type Boolean default true step type Number default methods submitHandler data this store commit cart SET CART EMAIL data email this emit updateSteps this step lt script gt You use the checkout step component created previously Inside it there is a short form with only one input field to validate the email and a submit button If the form is valid it will call the submitHandler method which will commit the cart SET CART EMAIL mutation to update the customer email on the cart store Later on the email will be sent to the Medusa server to associate it with the cart This method also emits an event to call a function on the parent component lt checkout flow gt to update the visibility for the current component and the next one This component will also be marked as completed Address ComponentThis component includes the form where the customer enters their shipping info Create the file components Checkout Steps Address vue with the following content lt template gt lt checkout step title Address show success icon isCompleted gt lt FormulateForm v show isOpen v slot hasErrors name formAddress class space y keep model data true submit submitHandler gt lt div class flex space x gt lt FormulateInput name first name label First name validation required class w gt lt FormulateInput name last name label Last name validation required class w gt lt div gt lt FormulateInput name company label Company class w full gt lt FormulateInput name address label Address validation required class w full gt lt FormulateInput name address label Apartment suite etc class w full gt lt div class flex space x gt lt FormulateInput type select name country code label Country validation required class w options countries gt lt FormulateInput name city label City validation required class w gt lt div gt lt div class flex space x gt lt FormulateInput name province label Province class w gt lt FormulateInput name postal code label ZIP Postal Code validation required number class w gt lt div gt lt FormulateInput name phone label Phone class w full gt lt div class flex items center justify between mt gt lt div class text gray flex items center text sm transform transition cursor pointer hover text black translate x click emit updateSteps step false gt lt span class w h mr gt lt svg fill version xmlns viewBox gt lt g gt lt path d M c L c L c c L c l c C z gt lt g gt lt svg gt lt span gt lt span gt Go back lt span gt lt div gt lt FormulateInput type submit label Next disabled hasErrors input class btn ui class mt gt lt div gt lt FormulateForm gt lt checkout step gt lt template gt lt script gt export default name Address props isCompleted type Boolean default false isOpen type Boolean default true step type Number default computed countries return this store state region countries map country gt label country display name value country iso methods submitHandler data this store dispatch cart updateCart shipping address data email this store state cart email this emit updateSteps this step lt script gt Similarly here you use the checkout step component but this time inside you will find a long form with several form inputs that will allow you to get the info to fill up the shipping address object needed to update the cart on the Medusa server If the form is submitted and valid it will call the submitHandler method which will dispatch the next action to the cart store defined in store cart js In that action you are sending a POST request to the endpoint store carts cartId with the customer s email and shipping address On the Medusa server a new address will be created and associated with the customer s cart Then when the response from the server is received a mutation is committed to update the cart info in the store Lastly the submitHandler function will emit an event to update the visibility for the address component and mark it as completed Delivery ComponentAfter the cart is updated with the customer s address you should display the shipping options to the customers so they can choose their preferred option To be able to do that add the next state mutation and action to the cart store in store cart js export const state gt shippingOptions export const mutations SET SHIPPING OPTIONS state shippingOptions state shippingOptions shippingOptions export const actions async getCartShippingOptions state commit const data shipping options options await this axios shipping options state cart id commit SET SHIPPING OPTIONS options In this action you are sending a GET request to the endpoint store shipping options cartId that responds with an updated list of shipping options Then when the response is received a mutation is committed to update the shipping options in the store These shipping options are rendered in the component you ll create next to allow the customer to choose one Create the file components Checkout Steps Delivery vue with the following content lt template gt lt checkout step title Delivery method show success icon isCompleted gt lt div v show isOpen class my gt lt div class text gray text xs flex items center mb gt lt div class bg gray text white w h rounded lg text center mr gt lt div gt lt p gt Taxes may apply and will be added upon continuation to the next step lt p gt lt div gt lt div class space y gt lt div v for option in shippingOptions key option id class shadow rounded md p w full border transparent flex justify between items center cursor pointer click store dispatch cart addShippingMethod option id gt lt div gt lt div class font semibold text sm gt option name lt div gt lt div class text xs text gray mt gt formatPrice option amount cartCurrencyCode lt div gt lt div gt lt checkout check icon v if shippingMethod option id gt lt div gt lt div gt lt div class w full flex items center justify between mt gt lt button class text gray flex items center text sm transform transition hover text black translate x click emit updateSteps step false gt lt span class w h mr gt lt svg fill version xmlns viewBox gt lt g gt lt path d M c L c L c c L c l c C z gt lt g gt lt svg gt lt span gt lt span gt Go back lt span gt lt button gt lt FormulateInput type button label Next input class btn ui click emit updateSteps step true gt lt div gt lt div gt lt checkout step gt lt template gt lt script gt import mapGetters from vuex import formatPrice from utils format price export default name Delivery props isCompleted type Boolean default false isOpen type Boolean default true step type Number default computed mapGetters shippingOptions cart shippingOptions cartCurrencyCode cart cartCurrencyCode shippingMethod cart shippingMethod created this store dispatch cart getCartShippingOptions methods formatPrice lt script gt When this component is created it dispatches the getCartShippingOptions action to fetch all the shipping options Then you loop the shippingOptions array to show the list to the customer When the list is rendered and the customer clicks on one of the available options an action is dispatched on the cart s store to add that option as a shipping method to the current cart Finally the form input button emits an event to update the visibility of the delivery component and mark it as completed Next add the next action in the cart s store located in store cart js export const actions async addShippingMethod state commit optionId const cart await this axios post carts state cart id shipping methods option id optionId commit SET CART cart You send a POST request to the endpoint store carts cartId shipping methods that creates a shipping method based on the shipping option chosen and associates it with the customer s cart Then add the shippingOptions and shippingMethod getters in store cart js to retrieve that info in an easy way export const getters shippingOptions state gt state shippingOptions shippingMethod state gt state cart shipping methods shipping option id Payment Component with StripeThis component is the last thing to implement in the checkout workflow In this step you first show a list of available payment providers so customers can choose one Once the payment provider is selected you need to initialize a payment session so you can process the payment Create the file components Checkout Steps Payment vue with the following content lt template gt lt checkout step title Payment show success icon isCompleted gt lt div v show isOpen gt lt div class flex space x my uppercase gt lt div v for provider id id in providers key id class w full px py border border gray rounded flex p items center justify between cursor pointer class provider provider id border green click provider provider id gt lt div gt provider id lt div gt lt checkout check icon v if provider provider id class ml gt lt div gt lt div gt lt div v show provider stripe gt lt div id stripe container class bg white rounded md p shadow mt class errors border border red gt lt div v if errors class text red text sm mt gt errors lt div gt lt div gt lt div class flex items center justify between mt gt lt button class text gray flex items center text sm transform transition hover text black translate x click emit updateSteps step false gt lt span class w h mr gt lt svg fill version xmlns viewBox gt lt g gt lt path d M c L c L c c L c l c C z gt lt g gt lt svg gt lt span gt lt span gt Go back lt span gt lt button gt lt FormulateInput type button label Pay input class btn ui click processPayment gt lt div gt lt div gt lt checkout step gt lt template gt lt script gt export default name Payment props isCompleted type Boolean default false isOpen type Boolean default true step type Number default data return provider null card null errors null computed providers return this store getters cart paymentProviders watch async isOpen val if val amp amp this providers length await this store dispatch cart createPaymentSession await this store dispatch cart setPaymentSession this providers provider id TODO watch for changes on the selected provider methods TODO add show UI provider and process payment methods lt script gt The providers computed property is used to fetch the providers and render them in the template section The watcher function isOpen is in charge of dispatching the cart createPaymentSession and cart setPaymentSession actions For this to actually work you need to add the cart paymentProviders getter and the cart createPaymentSession and cart setPaymentSession actions in store cart js export const getters paymentProviders state gt state cart payment sessions export const actions async createPaymentSession state commit const cart await this axios post carts state cart id payment sessions commit SET CART cart async setPaymentSession state commit providerId const cart await this axios post carts state cart id payment session provider id providerId commit SET CART cart The paymentProviders getter is to quickly retrieve the payment sessions array from the cart s store The createPaymentSession action sends a POST request to the endpoint store carts cartId payment sessions This initializes the payment sessions array in the cart object received The setPaymentSession action sends a POST request to the endpoint store carts cartId payment session to set the payment session property in the cart if there isn t one already set or if the customer changes payment providers You will now use the Stripe provider module that you installed previously for this Nuxt js storefront This is where the actual integration with Stripe happens So when customers choose a payment provider the click event sets the provider prop to that value If the provider is stripe you create a card element that the customer uses to enter their card information To achieve that replace the TODO comment in watch with the following provider val if val stripe this showStripeCard Then add this function to the methods property methods showStripeCard const elements this stripe elements const card elements create card card mount stripe container this card card You watch for changes in the provider prop If its value is stripe you run the showStripeCard method that uses the Stripe module to create an elements object Then you create a card element to be mounted on a div container Finally you assign the created card to the card prop You will use it later to make the payment and complete the cart Next you need to add the function that will be called by the form input to process the payment Inside the methods property add the following method async processPayment if this provider stripe await this store dispatch cart setPaymentSession this provider const error await this stripe confirmCardPayment this store getters cart clientSecret payment method card this card billing details email this email if error this errors error message if error const id await this store dispatch cart completeCart this router push order summary id Here the setPaymentSession action updates the payment session object in the cart object to include data related to Stripe This includes the payment intent and client secret Finally the line this router push order summary id function redirects the customer to an order summary page where they see the order details for the completed cart To get the client secret quickly from the cart add a clientSecret getter to the getters object in store cart js export const getters clientSecret state gt state cart payment session data client secret null To confirm a card payment you use this stripe confirmCardPayment This method requires two parameters the first one is the client secret that you can get from the customer s cart and the second one is the payment method object that includes the card element and the billing details object with at least the customer s email When that method is executed you can receive a successful response or an error If you get an error you need to update the errors variable to show the message to the customer Otherwise the remaining dispatch actions will be dispatched The cart completeCart action is run if the payment is confirmed successfully so to complete the cart add the following action in store cart js export const actions async completeCart state commit const type data order await this axios post carts state cart id complete if type order const cart await this axios post carts commit SET CART cart return order The action sends a POST request to the endpoint store carts cartId complete to complete the cart and place the order Your Medusa server will try to authorize the payment first then it will place the order if the authorization is successful If the type property in the received data is order you make a post request to the endpoint store carts to create a new cart then commit the SET CART mutation Finally replace the content of components Checkout Flow vue with the following lt template gt lt div class flex flex col gt lt component is step component v for step stepIndex in checkoutSteps key step component is open step isOpen is completed step isCompleted step stepIndex updateSteps updateSteps gt lt div gt lt template gt lt script gt import formatPrice from utils format price export default name CheckoutFlow data return checkoutSteps component checkout steps contact isCompleted false isOpen true component checkout steps address isCompleted false isOpen false component checkout steps delivery isCompleted false isOpen false component checkout steps payment isCompleted false isOpen false methods formatPrice updateSteps current forward true this checkoutSteps current isOpen false this checkoutSteps current isCompleted forward const nextOrBefore forward current current this checkoutSteps nextOrBefore isOpen true if forward amp amp nextOrBefore this checkoutSteps nextOrBefore isCompleted false lt script gt lt style lang scss gt formulate input amp label apply font semibold text sm mb block amp element gt input apply shadow rounded md px py text xs w full border transparent amp element gt select apply shadow rounded md px py text xs w full border transparent bg white amp element gt select gt option apply bg gray amp error apply text red text xs mt lt style gt In the template section you use dynamic components to load the four components needed in the checkout flow contact address delivery and payment For this to work you set up in the script section the initial state of the lt checkout flow gt component The checkoutSteps array contains the props for each step The updateSteps method is in charge to update the visibility and completion of each step Lastly in the style section you add some classes to style all the form inputs used in the contact and address steps Order SummaryAfter the customers places their order successfully they need to be redirected to a summary page where they can see an overview of their order Create the file pages order summary id vue with the following content lt template gt lt div class container mx auto p gt lt div v if order class layout base flex justify center pb gt lt div class max w xl gt lt span class text xs font medium mb gt THANK YOU lt span gt lt h class text xl font bold gt Order Confirmed lt h gt lt p class text md font light mt gt Your order lt span class font semibold gt order display id lt span gt was successfully processed You will receive an email with the tracking number of your parcel once it s available lt p gt lt div class my gt lt Start items section gt lt order item v for item in order items key item id item item currency order currency code gt lt div gt lt div gt lt totals item order gt lt div gt lt div gt lt div gt lt div v else gt We couldn t find your order it might have gone through but we can t seem to find it at the moment Please check your email for an order confirmation lt div gt lt div gt lt template gt lt script gt export default name OrderSummary data return order null async beforeMount const data order await this axios orders this route params id this order order lt script gt This page loads the lt order item gt component that is used to loop and display all the products that were purchased The lt totals gt component shows the order subtotal shipping costs taxes and total amount In the beforeMount function you make a request to your Medusa server to retrieve the order For that you need the order ID which you can get from the route parameter with this route params id All that is left is to create the lt order item gt component Create the file components Order Item vue with the following content lt template gt lt div class flex mb last mb gt lt div class bg ui rounded md overflow hidden mr max w gt lt img class h auto w full object cover src item thumbnail alt item title gt lt div gt lt div class flex text sm flex grow py gt lt div class flex flex col justify between w full flex grow gt lt div class flex flex col gt lt p class font semibold mb gt item title lt p gt lt p gt lt span class text ui dark gt Variant lt span gt item description lt p gt lt div gt lt div class flex space x text gray font light gt lt p class border r pr border gray gt Quantity lt span class text gray font semibold gt item quantity lt span gt lt p gt lt p gt Price lt span class text gray font semibold gt formatPrice item unit price currency item quantity lt span gt lt p gt lt div gt lt div gt lt div gt lt div gt lt template gt lt script gt import formatPrice from utils format price export default name CartItem props item type Object default return currency type String default USD methods formatPrice lt script gt This component receives the product information and renders it on the page It shows the product s title variant quantity and price Testing the Checkout FlowStart both your Medusa server and Nuxt js website if they aren t running Then go to your storefront URL http localhost and add some products to the cart When you are done adding products click on the bag icon at the top right to see the cart popover and click on the Checkout button If all the components for the checkout flow are working as expected you should get the following page As you can see the lt checkout summary gt component shows the info related to the products you added to the cart and gives you the total you have to pay On the other hand the lt checkout flow gt shows four card with one of the steps you have to follow to complete the checkout Fill up the email input and click on the Next button The contact form closes and the address component opens Then fill up the form with the shipping address and click on the Next button If the validation passes the delivery component will open next with the available shipping options rendered Choose one option and click Next You then will get the payment component with the available payment providers For this tutorial Stripe is the only provider but if you add more providers they will be displayed here as well Choose stripe as payment provider and write you payment information before clicking on the pay button Stripe offers several test cards to simulate payments to test your integration You can choose one of them here Once you re done click on Pay The payment will be simulated and if everything is successful you will be redirected to the Order summary page You can check if the payment was actually successful on the Stripe Dashboard Go to your Stripe dashboard and click on the Payments link at the top left You should see the payment with a status of uncaptured This means that Stripe was able to process the payment but it needs further action to be captured and to actually charge the customer To capture the payment start your Medusa admin with yarn run develop Then go to the Medusa admin website and click on Orders in the left sidebar You should see that one order was created Click on it to go to the order details page On this page scroll down to the payment section You will see that the status of the payment is Awaiting Next to it is Capture payment button If you click on it the payment will be captured through Stripe To confirm that the payment was captured go back to your stripe dashboard You should see the status for the payment that was already there changed to Succeeded ConclusionIn this tutorial you learned how to set up a basic checkout process to allow your customers to place orders and perform payment with Stripe Going forward you can focus on developing or adding new functionalities to your Nuxt js storefront including Add customer login and profile to give customers a way of managing their information view their orders and save payment details Integrate other payment providers such as PayPal Implement swap feature to allow customers to exchange products after purchase Use a notification system such as SendGrid to send the customer emails based on different events If you have any issues or questions related to Medusa feel free to reach out to the Medusa team via Discord 2022-06-28 11:05:30
Apple AppleInsider - Frontpage News AirPods swallowed by UK TV presenter in vitamin mixup https://appleinsider.com/articles/22/06/28/airpods-swallowed-by-uk-tv-presenter-in-vitamin-mixup?utm_medium=rss AirPods swallowed by UK TV presenter in vitamin mixupA celebrity in the UK accidentally swallowed an AirPod on Sunday mistakenly consuming the Apple wireless earbud along with her vitamins AirPods are known for being small and white and at a distance could be mistaken for a pebble or a large pill On Sunday one of the personal audio accessories had the misfortune of being treated as an edible tablet Posted to Twitter on Sunday and spotted by iMore UK property show TV presenter Kirstie Allsopp admitted that she had just swallowed an AirPod while downing my vitamins After telling her followers I don t recommend it Allsopp said she didn t need to go to the hospital as she managed to throw it up Read more 2022-06-28 11:47:08
Apple AppleInsider - Frontpage News Best iPad travel accessories for summer 2022 https://appleinsider.com/articles/22/06/28/best-ipad-travel-accessories-for-summer-2022?utm_medium=rss Best iPad travel accessories for summer The iPad s compact form factor makes it ideal to be taken with the user anywhere Here are some fantastic accessories to make on the go use that much better From the utilitarian keyboard and mouse setups to the best power accessories to prolong productivity sessions these are some of the best travel accessories for iPad Apple Magic Keyboard Read more 2022-06-28 11:34:28
Apple AppleInsider - Frontpage News Apple Silicon's M2 Pro may shift to 3nm process in late 2022 https://appleinsider.com/articles/22/06/28/apple-silicons-m2-pro-may-shift-to-3nm-process-in-late-2022?utm_medium=rss Apple Silicon x s M Pro may shift to nm process in late Apple Silicon could shift to a nanometer production process during the M generation a report claims instead of waiting to introduce the chips as part of M Apple s initial second generation Apple Silicon chip launch the M is one that uses a similar nanometer process for its construction as the M lineup In a Monday report it is believed that not all of the M range will be made using nanometer techniques Apple has reportedly booked capacity with chip partner TSMC for its nm production lines according to DigiTimes While not entirely unexpected of Apple to do so the report adds that it will be used for Apple s upcoming M Pro chips as well as its eventual M lineup Read more 2022-06-28 11:12:11
海外TECH Engadget The Morning After: Valve warns you, again, against modifying your Steam Deck https://www.engadget.com/the-morning-after-valve-warns-you-again-against-modifying-your-steam-deck-111540388.html?src=rss The Morning After Valve warns you again against modifying your Steam DeckValve loves to warn people about the risks of do it yourself Steam Deck maintenance and this time it s reminding you that trying to upgrade the built in storage could lead to problems Following a PC Gamer article on modding the Steam Deck Valve hardware designer Lawrence Yang warned against upgrading the device s NVMe SSD While it s technically possible the bigger M drives are hotter and more power hungry than the models the handheld was meant to support Yang added you could significantly shorten the longevity of the system You ve been told ーMat SmithThe biggest stories you might have missed Endless Dungeon is a tense mix of tower defense and twin stick hero shooterSamsung s TB Pro SSD returns to an all time low of Google s Nest WiFi packs drop to record low prices at AmazonHummer EV s obstacle avoiding Extract Mode adds six inches of ride heightValve ramps up production to more than double Steam Deck shipmentsYou could get your hands on the device sooner than expected And if you don t yet have a Steam Deck ーor you fried yours with an ill advised upgrade ーValve says it has boosted production and will ship more than twice the number of units each week Were you to reserve a Steam Deck now you likely wouldn t receive it until at least October However since Valve is ramping up the volume of shipments it may bring down that wait time Continue reading GoldenEra is a loving if muddled tribute to GoldenEye Covering the whole breadth of a video game s influence is harder than it looks NintendoThe Nintendo s GoldenEye ーthe rare Bond game that not only nailed the franchise tie in but elevated the experience ーis one of a handful of games that warrant a feature length making of documentary Drew Roller s GoldenEra tries to encompass the entire creative route from its genesis as a small project at Rare s rural farmland campus to the monster it became GoldenEra has been able to get many of the original team on the record supplemented by a number of journalists and talking heads from across the games industry But multiple segments ーthose covering Perfect Dark Free Radical Design and Timesplitters GoldenEye fan films and the modding community ーfeel a little shallow Continue reading LG buys its way into the EV charging businessIt s acquiring a charger manufacturing company LG is jumping into the EV charging business with the acquisition of a South Korean EV battery charger developer called AppleMango This should help it create fully featured charging stations with a user friendly interface and real time control and management it said In particular it ll leverage its sturdy dust and water proof outdoor digital display tech LG plans to install an EV charger production line at LG Digital Park in South Korea by the end of Continue reading Apple s entry level inch MacBook Pro M may have slower SSD speeds than the M modelThat could affect performance for app loading and more Apple s inch GB MacBook Pro M may have worse SSD performance than the equivalent M model according to testing by YouTube sites nbsp Max Tech nbsp and nbsp Created Tech The base model showed around percent slower read speeds and percent slower write speeds It turns out the inch MacBook Pro M has a single GB NAND flash storage chip instead of two GB chips like the previous M model That would mean the driver can only use two lanes in parallel restricting performance Continue reading The Supreme Court won t hear the Apple Qualcomm patent caseApple claimed Qualcomm might use two patents to sue again Apple and Qualcomm may have ended most of their feuding in but the fight isn t over just yet The Supreme Court has denied Apple s request for a hearing to possibly invalidate two Qualcomm patents that played key roles in s attempts to ban Apple Watch iPad and iPhone sales over alleged modem technology infringements The court didn t explain why it rejected the request but a Justice Department amicus brief from May argued there was no evidence to indicate the patents were harming Apple s business Continue reading Nintendo Direct on June th is all about third party Switch gamesNo Zelda maybe Silksong EngadgetA Nintendo Direct Mini is scheduled for June th at AM ET It probably won t feature news on Mario Zelda Pokémon or any of Nintendo s other franchises though Nintendo says it ll focus on third party titles on their way to Switch and it could be a fairly meaty affair It clocks in at minutes and Nintendo s online showcases usually run at a fair clip One of the more notable third party games slated for a Switch debut No Man s Sky already has a release date of October th so that may not get a heavy focus There s always the chance of more details on Hollow Knight Silksong which is slated to arrive in the next year Continue reading 2022-06-28 11:15:40
海外科学 NYT > Science NASA’s CAPSTONE Mission Launches to the Moon https://www.nytimes.com/2022/06/28/science/capstone-nasa-launch-moon.html small 2022-06-28 11:32:27
海外科学 NYT > Science Gas Piped Into Homes Contains Benzene and Other Risky Chemicals, Study Finds https://www.nytimes.com/2022/06/28/climate/natural-gas-home-toxic-chemicals.html Gas Piped Into Homes Contains Benzene and Other Risky Chemicals Study FindsWhile the concentrations are low the chemicals are potentially dangerous and some are linked to cancer risk the researchers found 2022-06-28 11:49:31
ニュース BBC News - Home Friends pay tribute to woman killed by stranger https://www.bbc.co.uk/news/uk-england-london-61963365?at_medium=RSS&at_campaign=KARANGA whole 2022-06-28 11:27:07
ニュース BBC News - Home Census: Population of England and Wales grew 6% in a decade https://www.bbc.co.uk/news/uk-61966084?at_medium=RSS&at_campaign=KARANGA rises 2022-06-28 11:49:36
ニュース BBC News - Home Non-essential petrol sales halted for two weeks in Sri Lanka https://www.bbc.co.uk/news/business-61961821?at_medium=RSS&at_campaign=KARANGA services 2022-06-28 11:15:07
ニュース BBC News - Home Kremenchuk strike: 'I didn't think they would hit a mall - it's a safe place' https://www.bbc.co.uk/news/world-europe-61967376?at_medium=RSS&at_campaign=KARANGA kremenchuk 2022-06-28 11:25:34
ニュース BBC News - Home Queen appears at armed forces parade in Edinburgh https://www.bbc.co.uk/news/uk-scotland-edinburgh-east-fife-61965005?at_medium=RSS&at_campaign=KARANGA scotland 2022-06-28 11:40:26
ニュース BBC News - Home Frenkie de Jong: Manchester United nearing agreement on £56m deal for Barcelona midfielder https://www.bbc.co.uk/sport/football/61965079?at_medium=RSS&at_campaign=KARANGA agreement 2022-06-28 11:47:03
北海道 北海道新聞 国内で1万9387人感染 16人死亡、新型コロナ https://www.hokkaido-np.co.jp/article/699158/ 新型コロナウイルス 2022-06-28 20:45:00
北海道 北海道新聞 広島サミット、来年5月19日 首相「惨禍繰り返さず」 https://www.hokkaido-np.co.jp/article/699157/ 岸田文雄 2022-06-28 20:45:00
北海道 北海道新聞 日大理事に女性2人が内定 林真理子さんの新体制で https://www.hokkaido-np.co.jp/article/699156/ 林真理子 2022-06-28 20:45:00
北海道 北海道新聞 井上尚「しっかり照準」 4団体統一へ練習再開 https://www.hokkaido-np.co.jp/article/699153/ 練習 2022-06-28 20:35:00
北海道 北海道新聞 値下げでNHK減収 コロナで制作費も減 https://www.hokkaido-np.co.jp/article/699152/ 発表 2022-06-28 20:19:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)