restomenu-preorder-sdk

JavaScript library for preorder modal functionality with global API

v1.3.0
PRODUCTION

📦 Build Information

Generated: 12/4/2025, 3:22:42 PM
Package: restomenu-preorder-sdk
Version: 1.3.0
License: MIT
Build Environment: production
Git Branch: unknown
Git Commit: unknown
Author: RestoMenu Team

Distribution Files

File Type Size Modified
preorder.umd.js UMD (Browser) 24.07 KB 12/4/2025, 3:22:19 PM
preorder.esm.js ES Modules 23.80 KB 12/4/2025, 3:22:31 PM
preorder.cjs.js CommonJS 23.86 KB 12/4/2025, 3:22:41 PM
index.d.ts TypeScript Definitions 0.37 KB 12/4/2025, 3:22:41 PM
types-only.d.ts TypeScript Definitions 0.42 KB 12/4/2025, 3:22:41 PM

🚀 Installation

CDN

<script src="https://pre-order-window-sdk.dev.restomenu.cc/preorder.umd.js"></script>

🌐 Browser Usage (UMD)

For direct browser usage via CDN or local files:

        
<script src="./preorder.umd.js"></script>
<script>
  // SDK is available as global 'preorder'
  preorder.open({
    pointId: 'your-point-id',
    serverUrl: 'https://external-menu.dev.restomenu.cc',
    theme: 'light',
    debug: true
  });
</script>

📦 ES Modules Usage

For modern bundlers (Webpack, Vite, etc.):

        
import preorder from 'restomenu-preorder-sdk';

preorder.open({
  pointId: 'your-point-id',
  serverUrl: 'https://external-menu.dev.restomenu.cc',
  theme: 'light',
  debug: true
});

⚙️ CommonJS Usage

For Node.js applications:

        
const preorder = require('restomenu-preorder-sdk');

preorder.open({
  pointId: 'your-point-id',
  serverUrl: 'https://external-menu.dev.restomenu.cc',
  theme: 'light',
  debug: true
});

🔷 TypeScript Usage

Full TypeScript support with type definitions:

        
import preorder, { PreorderConfig } from 'restomenu-preorder-sdk';

const config: PreorderConfig = {
  pointId: 'your-point-id',
  serverUrl: 'https://external-menu.dev.restomenu.cc',
  theme: 'light',
  debug: true
};

preorder.open(config);

⚙️ Advanced Configuration

Complete configuration example with all available options:

      
const fullConfig = {
  // Required parameters
  pointId: 'your-point-id',
  
  // Optional parameters
  serverUrl: 'https://external-menu.dev.restomenu.cc',
  orderId: 'existing-order-id', // For editing existing orders
  authCode: 'your-auth-code', // Authorization code for RestoPlace integration
  debug: true,
  timeout: 300000, // 5 minutes
  
  // Theme configuration
  theme: 'light', // 'light', 'dark', or custom theme object
  // OR custom theme:
  theme: {
    theme: 'custom',
    colors: {
      mode: 'light',
      primary: { main: '#e91e63' },
      secondary: { main: '#00bcd4' },
      error: { main: '#f44336' },
      warning: { main: '#ff9800' },
      info: { main: '#2196f3' },
      success: { main: '#4caf50' }
    }
  },
  
  // Animation settings
  animations: {
    enabled: true,
    duration: 300,
    easing: 'ease-in-out', // 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear'
    type: 'fade', // 'fade', 'scale', 'slide'
    delay: 0, // Animation delay in ms
    fillMode: 'forwards', // 'none', 'forwards', 'backwards', 'both'
    iterationCount: 1 // number or 'infinite'
  },
  
  // Modal configuration (logical settings only)
  modal: {
    position: 'center', // 'center', 'top', 'bottom'
    closeOnBackdropClick: true,
    closeOnEscape: true
    // Note: CSS properties (width, height, etc.) moved to styling section
  },
  
  // Styling options (all CSS properties)
  styling: {
    // Overlay styles
    zIndex: 10000,
    backdrop: 'rgba(0, 0, 0, 0.7)',
    
    // Visual styles
    borderRadius: 18,
    boxShadow: '0 10px 30px rgba(0, 0, 0, 0.3)',
    
    // Modal container CSS properties
    width: '90vw',
    height: '90vh',
    maxWidth: '1200px',
    maxHeight: '800px',
    backgroundColor: 'white',
    border: 'none',
    padding: '0',
    margin: 'auto',
    transform: 'none',
    overflow: 'hidden',
    
    // Any other CSS properties can be added here
    // For example:
    // fontFamily: 'Arial, sans-serif',
    // fontSize: '16px',
    // color: '#333333'
  }
};

// Open preorder with configuration
const result = await preorder.open(fullConfig);

// Handle result
if (result.code) {
  // Error occurred
  console.error('Error:', result.message);
} else {
  // Success
  console.log('Order created:', result.orderId);
  console.log('Total:', result.total, result.currency);
}

🔐 Authorization Code Management

Handle authorization codes for RestoPlace integration:

      
// Set authorization code before opening modal
preorder.setAuthCode('your-auth-code-here');

// Or include in configuration
const config = {
  pointId: 'your-point-id',
  authCode: 'your-auth-code-here',
  serverUrl: 'https://external-menu.dev.restomenu.cc'
};

// Get current authorization code
const currentCode = preorder.getAuthCode();
console.log('Current auth code:', currentCode);

// Clear authorization code
preorder.clearAuthCode();

// Open modal with auth code
const result = await preorder.open(config);

🛠️ SDK Methods

Available methods for controlling the SDK:

      
// Open preorder modal
const result = await preorder.open(config);

// Close modal programmatically
preorder.close();

// Set theme before or during modal usage
preorder.setTheme('light'); // 'light', 'dark'
preorder.setTheme({         // or custom theme object
  theme: 'custom',
  colors: {
    mode: 'light',
    primary: { main: '#e91e63' },
    secondary: { main: '#00bcd4' },
    error: { main: '#f44336' },
    warning: { main: '#ff9800' },
    info: { main: '#2196f3' },
    success: { main: '#4caf50' }
  }
});

// Configure SDK globally (settings persist across open() calls)
preorder.configure({
  serverUrl: 'https://external-menu.dev.restomenu.cc',
  debug: true,
  theme: 'dark',
  animations: { enabled: true, duration: 500 }
});

// Reset SDK to initial state
preorder.reset();

// Destroy SDK instance (cleanup)
preorder.destroy();

// Authorization code methods
preorder.setAuthCode('your-auth-code');
const authCode = preorder.getAuthCode();
preorder.clearAuthCode();

// Get SDK information
console.log('Version:', preorder.version);
console.log('Is Open:', preorder.isOpen);
console.log('Current Theme:', preorder.currentTheme);
console.log('Auth Code:', preorder.getAuthCode());

📋 CHANGELOG

Latest changes in version v1.3.0:

🚨 Breaking Changes

✨ Major Improvements

🔧 Configuration Enhancements

🛠️ Developer Experience

For complete changelog history, see the CHANGELOG.md file.