Akinon Release Notes (05/12/2025) are now live! Click here to learn what's new.
LogoLogo
API Reference
  • Home
  • Quick Start
  • Tutorials
  • Technical Guides
  • Release Notes
  • Glossary
  • Welcome to Akinon Technical Guides
  • ACC
    • ACC CLI
    • Create Application via CLI
    • Deploy Environment Variables
    • App Store for Developers
  • Omnitron
    • Product Types
    • Product Categorization
    • Splitting a Merged Order Item
  • Commerce
    • Shipping Rules Calculator
    • Data Source Shipping Options
    • Attribute Based Shipping Options
    • Filtering Products
    • Conversation & Messages
    • Sitemap Configuration
    • Weight-Based Product Sales
    • Group Attribute Sets
    • Contract Management
    • Find in Store for Whippy Ware
    • Plugins
    • Remote Price
    • E-mail Templates
    • Loyalty Accounts
    • Search Structure
    • User Segmentation & Rules
    • Promotions
  • OMS
    • Getting Started with OMS
    • Basic Setup
    • Scenarios
    • Capacity Feature
    • Package Management
      • Packages
      • Transfer
      • States
    • Commands
      • Packages
        • Package Command Parameters
        • DeAllocate Package Reservations Command
        • Channel Based Complete Packaging without Shipment Command
        • Complete Packaging with Shipment Command
        • Complete Packaging without Shipment Command
        • Package Refuse with Denial Reason Command
        • Product Not Found & Wrong Product Command
        • Product Not Found & Wrong Product Command Advanced
        • Package Packed for Refund Command
        • Block The Package For Action Command
        • Unblock the Package For Action Command
        • Update The Package’s Invoice
        • Manual Planning Command
      • Transfer
        • Transfer Order Advanced Command
        • Product for Transfer Not Found & Wrong Product Command
        • Transfer Delivered Command
        • Transfer Dispatch Command
        • Transfer Ready for Dispatch Command
        • Transfer Out Of Stock
      • Shipment
        • Shipment Order Command
        • Package Advanced Shipment Command
        • Ship The Package Command
        • Ship The Package without Shipment Integration Command
        • Update The Package’s Shipment Status Command
        • Update Shipment Info of Package Command
    • Inventory Locations & Engine
      • Properties & Domain Relation
      • Customization
      • Inventory Engine
    • Fulfillment
      • Shipments
      • Invoice Integration
    • Webhooks
      • Webhook Examples
        • Order Webhook
        • Package Webhook
        • Shipment Webhook
        • Stock Location Webhook
        • Transfer Webhook
    • Integrating OMS with Seller Center
  • Instore
    • Getting Started
    • Cash Register Integration
    • OTP (One Time Password) Process
    • Services
      • Password Reset Services
  • Marketplace Dashboard
    • N11 Marketplace Setup Configurations
    • Trendyol Marketplace Setup Configurations
    • Walmart Marketplace Setup Configurations
    • Amazon Marketplace Setup Configurations
    • Hepsiburada Marketplace Setup Configurations
  • Project Zero
    • Django
      • Basic Setup
      • Project Structure
        • Templates & Components
        • Private Dependencies
        • Omnife Project Submodule
        • Webpack
        • ESLint Rules
        • Bundles
        • Multilanguage & Translation
        • Environmental File
        • Custom Error Pages
        • Icon Font
      • Page Types
        • Static Pages & Flatpages
        • Account Page
          • Template Rendering in Account Pages
          • Forms & Validation
        • Basket Page
          • Redux Basket State
          • Basket Page - View
        • Checkout
          • Redux Checkout State
          • View & Template Rendering
          • Masking & Validation
      • Theming & Styling
      • Widgets
      • SEO Management
      • Extending Project Zero
    • Next.js
      • Basic Setup
      • Deployment
      • Static Assets
      • Plugins
      • Widgets
      • Icons
      • Localization
      • SEO Management
      • Advanced Usage
      • Data Fetching
        • Client
          • Account
          • Address
          • Basket
          • Checkout
          • Misc
          • Product
          • User
          • Wishlist
        • Server
          • Category
          • Flat Page
          • List
          • Menu
          • Product
          • SEO
          • Special Page
          • Widget
  • App Maker
    • Setup Your Environment
    • Plugin Quickstart
    • Create Project
    • Setup Existing Project
    • Deploy Project
    • Users and Roles
    • Add Public Key
    • App Maker CLI
    • Create App on Stores
      • Creating App on Apple App Store
      • Creating App on Google Play Store
    • Mobile App Framework
      • Configuration
      • Framework
      • Project Structure
        • Structure
        • Data Containers
        • Pages
      • Dependency Integration
        • Plugins
        • Akinon Plugin Adapter
  • Akifast
    • HPP
      • Getting Started
      • Authorization
      • Payment Session Creation
        • Key Points Before Creating a Payment Session
        • Creating Payment Session
        • Redirecting to the Payment Page
        • Errors Encountered During Payment Session Creation
      • Merchant Services
        • Shipping Query URL
        • Agreement Query URL
        • Other URLs
  • B2B
    • Getting Started
    • B2B Setup
  • Adds-on
    • Invoicer
      • Introduction
      • Invoice & Pay On Delivery Service
  • Channel App Template
    • Introduction
    • Installation and Usage
    • Development Steps
      • Folder Structure
      • Starting Step
      • Encoding the Sales Channel
        • Introduction
        • Setup
        • Products
        • Product Price
        • Product Stock
        • Product Image
        • Orders
        • Product Data
      • Adding a New Command to Akinon
      • Listening for External Requests
    • Architecture
      • Introduction
      • Integration
      • Services (Flows)
        • Introduction
        • Product Service
        • Price Service
        • Stock Service
        • Image Service
        • Order Service
  • Multi Regional Settings
    • Multi Regional Settings
Powered by GitBook

© 2025 Akinon. All rights reserved.

On this page
  • Widget Orders
  • Example Widget Order Schema​
  • Widget Integration​
  • Home Page​
  • Using the Client Server​
  • Server-Only Components​

Was this helpful?

  1. Project Zero
  2. Next.js

Widgets

Widget Orders

In certain cases, websites, particularly homepages, require frequent content updates. To eliminate the need for constantly editing code, a widget sorting system is used. This sorting widget is simple, featuring multiple text fields that facilitate the input of widget information and their reordering.

Once the Widget Order scheme has been integrated into Omnitron, the next step is to create a widget that allows for the addition of widget slugs. Instructions for creating this widget can be found below. The names of the created widgets are then entered based on this widget order.

Example Widget Order Schema​

{
    "widget_order": {
        "multi": true,
        "data_type": "nested",
        "key": "widget_order",
        "label": "Widget Order",
        "schema": {
            "item_slug": {
                "data_type": "text",
                "key": "item_slug",
                "label": "Widget Slug"
            }
        }
    }
}

Widget Integration​

Home Page​

  1. Create a Widget Order named home-widget-order and append the corresponding widget slug names to it.

  2. To retrieve the widget slug names that have been added, use the HOME_WIDGETS variable's slug name in the src/widgets/index.ts file along with the widget's relative path.

    export const HOME_WIDGETS: {
        [key: string]: ComponentType<WidgetResultType<unknown>>;
    } = {
        // @ts-expect-error Server Component
        'widget-slug-name': dynamic(async () => import('./widget-relative-path.ts'))
        };

Using the Client Server​

  1. In 'use client' components, import the useGetWidgetQuery function into the component.

    import { useGetWidgetQuery } from '@akinon/next/data/client/misc';
  2. Create a variable to hold the imported function, and pass the slug name of the targeted widget to this variable.

    const { data } = useGetWidgetQuery('slug-name');
  3. Retrieve the widget's data and either send it to another component using <ComponentName data={data} /> syntax or process it within the component where it was retrieved.

Server-Only Components​

  1. In 'server-only' components, import the getWidgetData function into the component.

    import { getWidgetData } from '@akinon/next/data/server';
  2. Prepare a type according to the schema of the created widget.

    Example Type​

    type  FooterMenuTitle = {
        value: string;
    };
    
    type  FooterMenuItem = [{
        kwargs: {
            data_type: 'nested';
            value: {
            is_side_column_item?: SideItem;
            is_target_blank: TargetBlank;
            };
        };
        value: {
            is_side_column_item?: string;
            is_target_blank: string;
            name: string;
            redirect_url: string;
        };
    }];
    
    type  FooterMenuType = {
        first_column_title: FooterMenuTitle;
        first_column_items: FooterMenuItem;
    };
  3. Create a variable for the imported function. Add the type for the getWidgetData function to this variable, and provide the widget's slug name to the function.

    const data = await getWidgetData<FooterMenuType>({ slug: 'footer-menu' });
  4. Obtain the data for the targeted widget as intended.

At times, there be a need to duplicate the same widget while supplying it with different data. In such situations, creating a widget content is necessary. To use the created widget, import the dynamic function.

import  dynamic  from  'next/dynamic';

After importing, create a variable to invoke the function, and call the function with the relative path of the preferred content as its argument.

const FooterMenuContent = dynamic(
    () => import('../views/widgets/footer-menu-content'),
    {ssr: false}
);

The FooterMenuContent component, which incorporates the desired content, is now available for use. To add this component, simply insert <FooterMenuContent data={data} /> at the desired location.

PreviousPluginsNextIcons

Last updated 16 days ago

Was this helpful?