UNPKG

@simonecoelhosfo/optimizely-mcp-server

Version:

Optimizely MCP Server for AI assistants with integrated CLI tools

325 lines 12.3 kB
/** * Common Entity Creation Patterns * Reusable patterns for creating different entity types */ export const entityCreationPatterns = { // Event Creation Patterns events: { conversion_event: { id: 'pattern_conversion_event', name: 'Conversion Event Pattern', description: 'Standard pattern for creating conversion events', template: { entity_type: 'event', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${event_name}', key: '${event_key}', event_type: 'custom', category: 'convert' } }, usage: 'Use for any event that represents a successful conversion (purchase, signup, etc.)' }, click_event: { id: 'pattern_click_event', name: 'Click Event Pattern', description: 'Pattern for tracking click interactions', template: { entity_type: 'event', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${element_name} Click', key: '${element_name}_click', event_type: 'click', selector: '${css_selector}' } }, usage: 'Use for tracking clicks on specific elements' }, custom_event: { id: 'pattern_custom_event', name: 'Custom Event Pattern', description: 'Generic pattern for custom events', template: { entity_type: 'event', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${event_name}', key: '${event_key}', event_type: 'custom', category: '${category}' // add_to_cart, save, search, share, purchase, convert, sign_up, subscribe, other } }, usage: 'Use for any custom event tracking needs' } }, // Attribute Creation Patterns attributes: { boolean_attribute: { id: 'pattern_boolean_attribute', name: 'Boolean Attribute Pattern', description: 'Pattern for true/false attributes', template: { entity_type: 'attribute', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', key: '${attribute_key}', name: '${attribute_name}', description: '${description}', type: 'boolean' } }, usage: 'Use for binary states like is_vip, has_subscription, etc.' }, number_attribute: { id: 'pattern_number_attribute', name: 'Number Attribute Pattern', description: 'Pattern for numeric attributes', template: { entity_type: 'attribute', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', key: '${attribute_key}', name: '${attribute_name}', description: '${description}', type: 'number' } }, usage: 'Use for numeric values like cart_value, age, score, etc.' }, list_attribute: { id: 'pattern_list_attribute', name: 'List Attribute Pattern', description: 'Pattern for attributes with predefined values', template: { entity_type: 'attribute', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', key: '${attribute_key}', name: '${attribute_name}', description: '${description}', type: 'list', list_type: 'string', values: '${allowed_values}' // Array of allowed values } }, usage: 'Use for attributes with limited options like customer_tier, region, etc.' } }, // Audience Creation Patterns audiences: { simple_condition: { id: 'pattern_simple_audience', name: 'Simple Condition Audience', description: 'Single condition audience pattern', template: { entity_type: 'audience', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${audience_name}', key: '${audience_key}', conditions: [ { field: '${attribute_key}', match: '${match_type}', // exact, gt, lt, contains, etc. value: '${value}' } ] } }, usage: 'Use for audiences based on a single attribute condition' }, complex_and_conditions: { id: 'pattern_and_audience', name: 'AND Conditions Audience', description: 'Multiple AND conditions pattern', template: { entity_type: 'audience', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${audience_name}', key: '${audience_key}', conditions: { and: [ { field: '${attribute1_key}', match: '${match_type1}', value: '${value1}' }, { field: '${attribute2_key}', match: '${match_type2}', value: '${value2}' } ] } } }, usage: 'Use when ALL conditions must be met' }, complex_or_conditions: { id: 'pattern_or_audience', name: 'OR Conditions Audience', description: 'Multiple OR conditions pattern', template: { entity_type: 'audience', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${audience_name}', key: '${audience_key}', conditions: { or: [ { field: '${attribute1_key}', match: '${match_type1}', value: '${value1}' }, { field: '${attribute2_key}', match: '${match_type2}', value: '${value2}' } ] } } }, usage: 'Use when ANY condition can be met' } }, // Extension Creation Patterns extensions: { project_javascript: { id: 'pattern_project_js', name: 'Project JavaScript Extension', description: 'Global JavaScript that runs on all pages', template: { entity_type: 'extension', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${extension_name}', key: '${extension_key}', description: '${description}', extension_point: 'project_javascript', enabled: true, javascript: '${javascript_code}', html: '', css: '' } }, usage: 'Use for tracking, analytics, or global functionality' }, custom_code_with_css: { id: 'pattern_custom_code_css', name: 'Custom Code with CSS', description: 'Extension with both JS and CSS', template: { entity_type: 'extension', mode: 'template', operation: 'create', template_data: { project_id: '${project_id}', name: '${extension_name}', key: '${extension_key}', description: '${description}', extension_point: 'project_javascript', enabled: true, javascript: '${javascript_code}', css: '${css_code}', html: '' } }, usage: 'Use when you need both styling and functionality' } }, // Variable Reference Patterns variable_resolution: { step_reference: { pattern: '${step_id.entity_id}', description: 'Reference entity ID from previous step', example: '${create_audience.entity_id}' }, step_key_reference: { pattern: '${step_id.entity_key}', description: 'Reference entity key from previous step', example: '${create_flag.entity_key}' }, nested_data_reference: { pattern: '${step_id.data.field_name}', description: 'Reference specific field from step response', example: '${create_campaign.data.status}' }, parameter_reference: { pattern: '${parameter_name}', description: 'Reference input parameter', example: '${project_id}' }, string_interpolation: { pattern: 'Text with ${variable}', description: 'Embed variables in strings', example: '${campaign_name} - Mobile Experience' } }, // Audience Reference Patterns (Critical!) audience_references: { specific_audience: { pattern: { ref: { id: '${audience_step.entity_id}' } }, description: 'Reference a specific audience', usage: 'Use when targeting a created audience' }, everyone: { pattern: { ref: { id: null } }, description: 'Target everyone (no audience restrictions)', usage: 'Use for experiments targeting all visitors' }, multiple_audiences_or: { pattern: { or: [ { ref: { id: '${audience1.entity_id}' } }, { ref: { id: '${audience2.entity_id}' } } ] }, description: 'Target visitors in ANY of these audiences', usage: 'Use when visitor can be in audience A OR audience B' }, multiple_audiences_and: { pattern: { and: [ { ref: { id: '${audience1.entity_id}' } }, { ref: { id: '${audience2.entity_id}' } } ] }, description: 'Target visitors in ALL of these audiences', usage: 'Use when visitor must be in audience A AND audience B' } } }; //# sourceMappingURL=EntityCreationPatterns.js.map