flowgrid-sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react/jsx-runtime"),require("react"),require("vue"),function(){try{return require("next/navigation")}catch(t){}}()):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react","vue","next/navigation"],e):"object"==typeof exports?exports.FlowGridSDK=e(require("react/jsx-runtime"),require("react"),require("vue"),function(){try{return require("next/navigation")}catch(t){}}()):t.FlowGridSDK=e(t["react/jsx-runtime"],t.React,t.Vue,t["next/navigation"])}(this,(t,e,a,i)=>(()=>{"use strict";var n={500(t){if(void 0===i){var e=new Error("Cannot find module 'next/navigation'");throw e.code="MODULE_NOT_FOUND",e}t.exports=i},272(e){e.exports=t},12(t){t.exports=e},594(t){t.exports=a}},r={};function s(t){var e=r[t];if(void 0!==e)return e.exports;var a=r[t]={exports:{}};return n[t](a,a.exports,s),a.exports}s.d=(t,e)=>{for(var a in e)s.o(e,a)&&!s.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};s.d(o,{xq:()=>u,EC:()=>_,RW:()=>f,RE:()=>O,sV:()=>w,aj:()=>m,TO:()=>y,Y0:()=>S,T$:()=>I,_O:()=>l,lk:()=>h,P:()=>v,AN:()=>g,zr:()=>D,ux:()=>c,qn:()=>d});class p{constructor(t,e,a){if(!t||!e||0===t.length||0===e.length)throw new Error("SDK init failed: webId and endpoint are required.");this.webId=t,this.endpoint=e,this.apiKey=a}async init(t,e={},a="POST"){this.validateInput(t,e);const i=`https://${this.endpoint}/sdk/functions?call=${e.type||"event"}`,n=JSON.stringify({web_id:this.webId,event_name:t,properties:e}),r=new AbortController,s=setTimeout(()=>r.abort(),1e4);try{const t=await fetch(i,{method:a,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:"POST"===a||"PATCH"===a?n:void 0,signal:r.signal});if(clearTimeout(s),!t.ok){const e=t.statusText||"Unknown error";throw new Error(`Failed to track event: ${t.status} ${e}`)}return await t.json()}catch(t){if(t instanceof Error&&"AbortError"===t.name)throw new Error("Request timed out");throw t}}validateInput(t,e){if(!t||"string"!=typeof t||0===t.trim().length)throw new Error("Event name must be a non-empty string");if(t.length>100)throw new Error("Event name must be less than 100 characters");const a=["password","token","secret","key","apikey","authorization"],i=JSON.stringify(e).toLowerCase();for(const t of a)i.includes(t)&&console.warn(`Warning: Properties may contain sensitive data (${t}). Please ensure this is intended.`);if(JSON.stringify({web_id:this.webId,event_name:t,properties:e}).length>1e4)throw new Error("Event payload too large (max 10KB)")}}class u extends p{async create(t){return await this.init(t.eventName,{...t.properties,type:"activation",timestamp:(new Date).toISOString()})}async trackOnboardingStep(t){return await this.init("onboarding_step",{type:"activation",subtype:"onboarding_step",userId:t.userId,stepId:t.stepId,stepName:t.stepName,stepOrder:t.stepOrder,totalSteps:t.totalSteps,progress:Math.round(t.stepOrder/t.totalSteps*100),timeSpent:t.timeSpent,skipped:t.skipped||!1,...t.properties,timestamp:(new Date).toISOString()})}async completeOnboarding(t,e,a,i){return await this.init("onboarding_completed",{type:"activation",subtype:"onboarding_complete",userId:t,totalTimeSpent:e,stepsCompleted:a,stepsSkipped:i,completionRate:Math.round(a/(a+i)*100),timestamp:(new Date).toISOString()})}async trackFirstAction(t){return await this.init("first_action",{type:"activation",subtype:"first_action",userId:t.userId,actionName:t.actionName,timeSinceSignup:t.timeSinceSignup,source:t.source,...t.properties,timestamp:(new Date).toISOString()})}async trackSignup(t,e,a,i){return await this.init("signup_completed",{type:"activation",subtype:"signup",userId:t,method:e,source:a,...i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_activation_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class c extends p{async create(t){return await this.init(t.eventName,{...t.properties,type:"feature_usage",timestamp:(new Date).toISOString()})}async trackUsage(t){return await this.init("feature_usage",{type:"feature_usage",subtype:t.action,featureId:t.featureId,featureName:t.featureName,userId:t.userId,action:t.action,duration:t.duration,success:t.success,category:t.category,...t.properties,timestamp:(new Date).toISOString()})}async trackDiscovery(t){return await this.init("feature_discovery",{type:"feature_usage",subtype:"discovery",featureId:t.featureId,userId:t.userId,discoveryMethod:t.discoveryMethod,engaged:t.engaged,timestamp:(new Date).toISOString()})}async trackAdoption(t,e,a){return await this.init("feature_adopted",{type:"feature_usage",subtype:"adoption",featureId:t,userId:e,source:a,timestamp:(new Date).toISOString()})}async trackAbandonment(t,e,a,i){return await this.init("feature_abandoned",{type:"feature_usage",subtype:"abandonment",featureId:t,userId:e,reason:a,timeSpent:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_feature_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class d extends p{async create(t){return await this.init(t.eventName,{...t.properties,type:"prompt",timestamp:(new Date).toISOString()})}async trackSubmission(t){return await this.init("prompt_submitted",{type:"prompt",subtype:"submission",promptId:t.promptId,userId:t.userId,promptType:t.promptType,model:t.model,inputTokens:t.inputTokens,conversationId:t.conversationId,...t.properties,timestamp:(new Date).toISOString()})}async trackResponse(t){return await this.init("prompt_response",{type:"prompt",subtype:"response",promptId:t.promptId,responseTime:t.responseTime,outputTokens:t.outputTokens,completed:t.completed,error:t.error,qualityScore:t.qualityScore,timestamp:(new Date).toISOString()})}async trackFeedback(t){return await this.init("prompt_feedback",{type:"prompt",subtype:"feedback",promptId:t.promptId,userId:t.userId,feedbackType:t.feedbackType,rating:t.rating,comment:t.comment,timestamp:(new Date).toISOString()})}async trackConversation(t,e,a,i){return await this.init("prompt_conversation",{type:"prompt",subtype:"conversation",conversationId:t,userId:e,turnCount:a,totalDuration:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_prompt_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class m extends p{async track(t){return await this.init(t.eventName,{...t.properties,type:"experiment",variant:t.variant,timestamp:(new Date).toISOString()})}async define(t){return await this.init("experiment_defined",{type:"experiment",subtype:"definition",...t,timestamp:(new Date).toISOString()})}async assign(t){return await this.init("experiment_assigned",{type:"experiment",subtype:"assignment",experimentId:t.experimentId,userId:t.userId,variantId:t.variantId,source:t.source||"random",timestamp:(new Date).toISOString()})}async trackConversion(t){return await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:t.experimentId,userId:t.userId,variantId:t.variantId,metricName:t.metricName,value:t.value,timestamp:(new Date).toISOString()})}async trackExposure(t,e,a){return await this.init("experiment_exposure",{type:"experiment",subtype:"exposure",experimentId:t,userId:e,variantId:a,timestamp:(new Date).toISOString()})}async getResults(t){return await this.init("get_experiment_results",{type:"query",experimentId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_experiment_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class y extends p{async evaluate(t){return await this.init(t.eventName,{...t.properties,type:"feature_flag_evaluation",timestamp:(new Date).toISOString()})}async trackEvaluation(t){return await this.init("flag_evaluated",{type:"feature_flag_evaluation",flagKey:t.flagKey,userId:t.userId,context:t.context,result:t.result,reason:t.reason||"default",duration:t.duration,timestamp:(new Date).toISOString()})}async define(t){return await this.init("flag_defined",{...t,type:"feature_flag_definition",timestamp:(new Date).toISOString()})}async trackStatusChange(t,e,a){return await this.init("flag_status_changed",{type:"feature_flag_status",flagKey:t,enabled:e,changedBy:a,timestamp:(new Date).toISOString()})}async trackRolloutChange(t,e,a,i){return await this.init("flag_rollout_changed",{type:"feature_flag_rollout",flagKey:t,previousPercentage:e,newPercentage:a,changedBy:i,timestamp:(new Date).toISOString()})}async getFlagAnalytics(t,e){return await this.init("get_flag_analytics",{type:"query",flagKey:t,filter:e||{range:"last30days"},timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_all_flags_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class l extends p{async track(t){return await this.init("page_view",{type:"page_view",url:t.url,path:t.path,title:t.title||"",referrer:t.referrer||"",userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackScrollDepth(t){return await this.init("scroll_depth",{type:"scroll_depth",path:t.path,scrollDepth:Math.min(100,Math.max(0,t.scrollDepth)),timeAtDepth:t.timeAtDepth,timestamp:(new Date).toISOString()})}async trackTimeOnPage(t){return await this.init("time_on_page",{type:"time_on_page",path:t.path,duration:t.duration,engaged:t.engaged??!1,timestamp:(new Date).toISOString()})}async trackExit(t,e,a){return await this.init("page_exit",{type:"page_exit",path:t,duration:e,scrollDepth:a,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_page_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}}class g extends p{async start(t={}){return await this.init("session_start",{type:"session_start",user:t.user,device:t.device,location:t.location,source:t.source||t.utm?.utmSource,medium:t.medium||t.utm?.utmMedium,campaign:t.campaign||t.utm?.utmCampaign,utm:t.utm,landingPage:t.landingPage||("undefined"!=typeof window?window.location.href:""),referrer:t.referrer||("undefined"!=typeof document?document.referrer:""),...t.properties,timestamp:(new Date).toISOString()})}async update(t,e){return await this.init("session_update",{type:"session_update",sessionId:t,...e,timestamp:(new Date).toISOString()})}async end(t){return await this.init("session_end",{type:"session_end",sessionId:t,timestamp:(new Date).toISOString()})}async heartbeat(t){return await this.init("session_heartbeat",{type:"session_heartbeat",sessionId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_session_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getRealTime(){return await this.init("get_realtime_sessions",{type:"query",realtime:!0,timestamp:(new Date).toISOString()})}}class w extends p{async track(t){return await this.init("custom_event",{type:"custom_event",eventName:t.eventName,category:t.category||"general",action:t.action,label:t.label,value:t.value,nonInteraction:t.nonInteraction||!1,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackBatch(t){const e=t.events.map(t=>({...t,timestamp:(new Date).toISOString()}));return await this.init("batch_events",{type:"batch_events",events:e,count:e.length,timestamp:(new Date).toISOString()})}async trackClick(t){return await this.init("click_event",{type:"click_event",...t,timestamp:(new Date).toISOString()})}async trackForm(t){return await this.init("form_event",{type:"form_event",...t,timestamp:(new Date).toISOString()})}async trackSearch(t){return await this.init("search_event",{type:"search_event",query:t.query,category:t.category,resultsCount:t.resultsCount,resultClicked:t.resultClicked,clickedPosition:t.clickedPosition,filters:t.filters,timestamp:(new Date).toISOString()})}async trackError(t){return await this.init("error_event",{type:"error_event",message:t.message,stack:t.stack,errorType:t.type,fatal:t.fatal||!1,context:t.context,userAction:t.userAction,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_event_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:50},timestamp:(new Date).toISOString()})}}class I extends p{async user(t){return await this.init("identify_user",{type:"identify",userId:t.userId,anonymousId:t.anonymousId,traits:t.traits||{},timestamp:(new Date).toISOString()})}async updateTraits(t,e){return await this.init("update_traits",{type:"update_traits",userId:t,traits:e,timestamp:(new Date).toISOString()})}async alias(t){return await this.init("alias_user",{type:"alias",previousId:t.previousId,userId:t.userId,timestamp:(new Date).toISOString()})}async group(t){return await this.init("group_user",{type:"group",userId:t.userId,groupId:t.groupId,traits:t.traits||{},timestamp:(new Date).toISOString()})}async reset(t){return await this.init("reset_identity",{type:"reset",userId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_user_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class S extends p{async define(t){return await this.init("define_funnel",{type:"define_funnel",funnelId:t.funnelId,name:t.name,description:t.description,steps:t.steps,timestamp:(new Date).toISOString()})}async trackStep(t){return await this.init("funnel_step",{type:"funnel_step",funnelId:t.funnelId,step:t.step,stepNumber:t.stepNumber,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackComplete(t,e,a){return await this.init("funnel_complete",{type:"funnel_complete",funnelId:t,userId:e,...a,timestamp:(new Date).toISOString()})}async trackAbandon(t,e,a,i){return await this.init("funnel_abandon",{type:"funnel_abandon",funnelId:t,lastStep:e,userId:a,reason:i,timestamp:(new Date).toISOString()})}async analyze(t,e){return await this.init("analyze_funnel",{type:"query",funnelId:t,filter:e||{range:"last30days"},timestamp:(new Date).toISOString()})}async compare(t,e,a){return await this.init("compare_funnel",{type:"query",funnelId:t,baselineFilter:e,comparisonFilter:a,timestamp:(new Date).toISOString()})}async list(){return await this.init("list_funnels",{type:"query",timestamp:(new Date).toISOString()})}}class h extends p{async view(t){return await this.init("product_view",{type:"product_view",product:{productId:t.productId,name:t.name,brand:t.brand,category:t.category,variant:t.variant,price:t.price,currency:t.currency,url:t.url,imageUrl:t.imageUrl,rating:t.rating,reviewCount:t.reviewCount,stockStatus:t.stockStatus,attributes:t.attributes},source:t.source,searchQuery:t.searchQuery,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async impression(t){return await this.init("product_impression",{type:"product_impression",list:t.list,productCount:t.list.products.length,userId:t.userId,sessionId:t.sessionId,timestamp:(new Date).toISOString()})}async click(t){return await this.init("product_click",{type:"product_click",product:t.product,listId:t.listId,position:t.position,userId:t.userId,timestamp:(new Date).toISOString()})}async quickView(t,e){return await this.init("product_quick_view",{type:"product_quick_view",product:t,listId:e,timestamp:(new Date).toISOString()})}async interaction(t,e,a){return await this.init("product_interaction",{type:"product_interaction",productId:t,action:e,...a,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_product_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getProductPerformance(t,e){return await this.init("get_product_performance",{type:"query",productId:t,filter:e||{range:"last30days"},timestamp:(new Date).toISOString()})}}class _ extends p{async addItem(t){const e=t.product.price*t.quantity-(t.product.discount||0);return await this.init("add_to_cart",{type:"add_to_cart",product:t.product,quantity:t.quantity,lineTotal:e,cartId:t.cartId,userId:t.userId,source:t.source,...t.properties,timestamp:(new Date).toISOString()})}async removeItem(t){return await this.init("remove_from_cart",{type:"remove_from_cart",product:t.product,quantity:t.quantity,cartId:t.cartId,userId:t.userId,reason:t.reason||"user_action",timestamp:(new Date).toISOString()})}async updateItem(t){return await this.init("update_cart_item",{type:"update_cart_item",product:t.product,previousQuantity:t.previousQuantity,newQuantity:t.newQuantity,quantityChange:t.newQuantity-t.previousQuantity,cartId:t.cartId,timestamp:(new Date).toISOString()})}async view(t){return await this.init("view_cart",{type:"view_cart",cart:t.cart,cartValue:t.cart.total,itemCount:t.cart.itemCount,userId:t.userId,timestamp:(new Date).toISOString()})}async abandon(t,e){return await this.init("cart_abandoned",{type:"cart_abandoned",cart:t,cartValue:t.total,itemCount:t.itemCount,reason:e,timestamp:(new Date).toISOString()})}async applyCoupon(t,e,a,i){return await this.init("apply_coupon",{type:"apply_coupon",cartId:t,couponCode:e,success:a,discount:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_cart_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class f extends p{async begin(t){return await this.init("begin_checkout",{type:"begin_checkout",cart:t.cart,cartValue:t.cart.total,itemCount:t.cart.itemCount,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async step(t){return await this.init("checkout_step",{type:"checkout_step",step:t.step,stepNumber:t.stepNumber,cart:t.cart,option:t.option,userId:t.userId,timestamp:(new Date).toISOString()})}async addShipping(t){return await this.init("add_shipping_info",{type:"add_shipping_info",cart:t.cart,shipping:t.shipping,shippingMethod:t.shipping.method,shippingCost:t.shipping.cost,userId:t.userId,timestamp:(new Date).toISOString()})}async addPayment(t){return await this.init("add_payment_info",{type:"add_payment_info",cart:t.cart,payment:t.payment,paymentMethod:t.payment.method,userId:t.userId,timestamp:(new Date).toISOString()})}async abandon(t,e,a){return await this.init("checkout_abandoned",{type:"checkout_abandoned",cart:t,step:e,cartValue:t.total,reason:a,timestamp:(new Date).toISOString()})}async paymentAttempt(t,e,a,i){return await this.init("payment_attempt",{type:"payment_attempt",success:t,cart:e,payment:a,errorCode:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_checkout_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class v extends p{async track(t){const e=t.order;return await this.init("purchase",{type:"purchase",order:{orderId:e.orderId,items:e.items,subtotal:e.subtotal,discountTotal:e.discountTotal,shippingTotal:e.shippingTotal,taxTotal:e.taxTotal,total:e.total,currency:e.currency,shipping:e.shipping,payment:e.payment,coupons:e.coupons,affiliation:e.affiliation},revenue:e.total,itemCount:e.items.reduce((t,e)=>t+e.quantity,0),userId:t.userId,sessionId:t.sessionId,attribution:t.attribution,...t.properties,timestamp:(new Date).toISOString()})}async statusChange(t,e,a){return await this.init("order_status_change",{type:"order_status_change",orderId:t,newStatus:e,previousStatus:a,timestamp:(new Date).toISOString()})}async shipped(t,e){return await this.init("order_shipped",{type:"order_shipped",orderId:t,shipping:e,timestamp:(new Date).toISOString()})}async delivered(t,e){return await this.init("order_delivered",{type:"order_delivered",orderId:t,deliveredAt:e||(new Date).toISOString(),timestamp:(new Date).toISOString()})}async getRevenue(t){return await this.init("get_revenue_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}async getRecentOrders(t){return await this.init("get_recent_orders",{type:"query",pagination:t||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getOrder(t){return await this.init("get_order",{type:"query",orderId:t,timestamp:(new Date).toISOString()})}}class O extends p{async getCustomerValue(t){return await this.init("get_customer_value",{type:"query",userId:t,timestamp:(new Date).toISOString()})}async recordAcquisitionCost(t){return await this.init("record_acquisition_cost",{type:"acquisition_cost",userId:t.userId,cost:t.cost,channel:t.channel,campaign:t.campaign,timestamp:(new Date).toISOString()})}async updateSegment(t,e){return await this.init("update_customer_segment",{type:"segment_update",userId:t,segment:e,timestamp:(new Date).toISOString()})}async getTopCustomers(t=100){return await this.init("get_top_customers",{type:"query",limit:t,sortBy:"totalRevenue",sortOrder:"desc",timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_ltv_analytics",{type:"query",filter:t||{range:"last90days"},timestamp:(new Date).toISOString()})}}class D extends p{async start(t){return await this.init("subscription_start",{type:"subscription_start",subscriptionId:t.subscriptionId,userId:t.userId,plan:t.plan,mrr:t.mrr,billingCycle:t.billingCycle,trialDays:t.trialDays,coupon:t.coupon,isTrialing:(t.trialDays||0)>0,...t.properties,timestamp:(new Date).toISOString()})}async change(t){const e=t.newMrr.amount-t.previousMrr.amount;return await this.init("subscription_change",{type:"subscription_change",subscriptionId:t.subscriptionId,userId:t.userId,previousPlan:t.previousPlan,newPlan:t.newPlan,previousMrr:t.previousMrr,newMrr:t.newMrr,mrrChange:e,changeType:t.changeType,timestamp:(new Date).toISOString()})}async cancel(t){return await this.init("subscription_cancel",{type:"subscription_cancel",subscriptionId:t.subscriptionId,userId:t.userId,plan:t.plan,lostMrr:t.lostMrr,reason:t.reason,feedback:t.feedback,immediate:t.immediate,timestamp:(new Date).toISOString()})}async renew(t,e,a){return await this.init("subscription_renew",{type:"subscription_renew",subscriptionId:t,userId:e,mrr:a,timestamp:(new Date).toISOString()})}async trialConverted(t,e,a,i){return await this.init("trial_converted",{type:"trial_converted",subscriptionId:t,userId:e,plan:a,mrr:i,timestamp:(new Date).toISOString()})}async trialExpired(t,e){return await this.init("trial_expired",{type:"trial_expired",subscriptionId:t,userId:e,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_subscription_analytics",{type:"query",filter:t||{range:"thisMonth"},timestamp:(new Date).toISOString()})}}s(272);var b=s(12);let k,x;(0,b.createContext)(null),s(594),Symbol("FlowGrid");try{const t=s(500);k=t.usePathname,x=t.useSearchParams}catch{k=()=>"undefined"!=typeof window?window.location.pathname:"/",x=()=>"undefined"!=typeof window?new URLSearchParams(window.location.search):new URLSearchParams}return(0,b.createContext)(null),o.default})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react/jsx-runtime"),require("react"),require("vue"),function(){try{return require("next/navigation")}catch(t){}}()):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react","vue","next/navigation"],e):"object"==typeof exports?exports.FlowGridSDK=e(require("react/jsx-runtime"),require("react"),require("vue"),function(){try{return require("next/navigation")}catch(t){}}()):t.FlowGridSDK=e(t["react/jsx-runtime"],t.React,t.Vue,t["next/navigation"])}(this,(t,e,a,i)=>(()=>{"use strict";var r={500(t){if(void 0===i){var e=new Error("Cannot find module 'next/navigation'");throw e.code="MODULE_NOT_FOUND",e}t.exports=i},272(e){e.exports=t},12(t){t.exports=e},594(t){t.exports=a}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var a=n[t]={exports:{}};return r[t](a,a.exports,s),a.exports}s.d=(t,e)=>{for(var a in e)s.o(e,a)&&!s.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o={};s.d(o,{xq:()=>c,EC:()=>_,RW:()=>f,RE:()=>v,sV:()=>I,aj:()=>d,TO:()=>y,Y0:()=>S,T$:()=>w,_O:()=>l,lk:()=>h,P:()=>b,AN:()=>g,zr:()=>O,ux:()=>u,qn:()=>m});class p{constructor(t,e,a){if(!t?.trim()||!e?.trim())throw new Error("SDK init failed: webId and endpoint are required.");this.webId=t.trim(),this.endpoint=this.normalizeEndpoint(e),this.apiKey=a}async init(t,e={},a="POST"){this.validateInput(t,e);const i=e.type||"event",r=`${this.endpoint}/sdk/functions?call=${encodeURIComponent(i)}`,n=JSON.stringify({web_id:this.webId,event_name:t,properties:e});return this.executeRequest(r,a,"GET"===a?void 0:n)}async executeRequest(t,e,a){let i=0;for(;;){const r=new AbortController,n=setTimeout(()=>r.abort(),p.TIMEOUT_MS);try{const i=await fetch(t,{method:e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:a,signal:r.signal});if(clearTimeout(n),!i.ok){const t=await this.safeRead(i);throw new Error(`SDK request failed (${i.status} ${i.statusText}) ${t}`)}return await i.json()}catch(t){if(clearTimeout(n),t instanceof Error&&("AbortError"===t.name||t.message.includes("fetch"))&&i<p.MAX_RETRIES){i++;continue}if(t instanceof Error&&"AbortError"===t.name)throw new Error("SDK request timed out");throw t}}}validateInput(t,e){if(!t||"string"!=typeof t||!t.trim())throw new Error("Event name must be a non-empty string");if(t.length>100)throw new Error("Event name must be less than 100 characters");let a;try{a=JSON.stringify({web_id:this.webId,event_name:t,properties:e})}catch{throw new Error("Properties must be JSON serializable")}if((new TextEncoder).encode(a).length>p.MAX_PAYLOAD_SIZE)throw new Error("Event payload too large (max 10KB)");const i=["password","token","secret","apikey","authorization"],r=a.toLowerCase();for(const t of i)r.includes(t)&&console.warn(`SDK Warning: Properties may contain sensitive data (${t}).`)}normalizeEndpoint(t){let e=t.trim();return e.startsWith("http://")||e.startsWith("https://")||(e=`https://${e}`),e.replace(/\/+$/,"")}async safeRead(t){try{return await t.text()}catch{return""}}}p.MAX_PAYLOAD_SIZE=1e4,p.TIMEOUT_MS=1e4,p.MAX_RETRIES=1;class c extends p{async create(t){return await this.init(t.eventName,{...t.properties,type:"activation",timestamp:(new Date).toISOString()})}async trackOnboardingStep(t){return await this.init("onboarding_step",{type:"activation",subtype:"onboarding_step",userId:t.userId,stepId:t.stepId,stepName:t.stepName,stepOrder:t.stepOrder,totalSteps:t.totalSteps,progress:Math.round(t.stepOrder/t.totalSteps*100),timeSpent:t.timeSpent,skipped:t.skipped||!1,...t.properties,timestamp:(new Date).toISOString()})}async completeOnboarding(t,e,a,i){return await this.init("onboarding_completed",{type:"activation",subtype:"onboarding_complete",userId:t,totalTimeSpent:e,stepsCompleted:a,stepsSkipped:i,completionRate:Math.round(a/(a+i)*100),timestamp:(new Date).toISOString()})}async trackFirstAction(t){return await this.init("first_action",{type:"activation",subtype:"first_action",userId:t.userId,actionName:t.actionName,timeSinceSignup:t.timeSinceSignup,source:t.source,...t.properties,timestamp:(new Date).toISOString()})}async trackSignup(t,e,a,i){return await this.init("signup_completed",{type:"activation",subtype:"signup",userId:t,method:e,source:a,...i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_activation_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class u extends p{async create(t){return await this.init("create_tracking",{type:"feature_usage",subtype:"create_custom",userId:t.userId,category:t.category,action:t.action,...t.properties,timestamp:(new Date).toISOString()})}async trackUsage(t){return await this.init("feature_usage",{type:"feature_usage",subtype:t.action,featureId:t.featureId,featureName:t.featureName,userId:t.userId,action:t.action,duration:t.duration,success:t.success,category:t.category,...t.properties,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_feature_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class m extends p{async create(t){return await this.init(t.eventName,{...t.properties,type:"prompt",timestamp:(new Date).toISOString()})}async trackSubmission(t){return await this.init("prompt_submitted",{type:"prompt",subtype:"submission",promptId:t.promptId,userId:t.userId,promptType:t.promptType,model:t.model,inputTokens:t.inputTokens,conversationId:t.conversationId,...t.properties,timestamp:(new Date).toISOString()})}async trackResponse(t){return await this.init("prompt_response",{type:"prompt",subtype:"response",promptId:t.promptId,responseTime:t.responseTime,outputTokens:t.outputTokens,completed:t.completed,error:t.error,qualityScore:t.qualityScore,timestamp:(new Date).toISOString()})}async trackFeedback(t){return await this.init("prompt_feedback",{type:"prompt",subtype:"feedback",promptId:t.promptId,userId:t.userId,feedbackType:t.feedbackType,rating:t.rating,comment:t.comment,timestamp:(new Date).toISOString()})}async trackConversation(t,e,a,i){return await this.init("prompt_conversation",{type:"prompt",subtype:"conversation",conversationId:t,userId:e,turnCount:a,totalDuration:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_prompt_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class d extends p{async track(t){return await this.init(t.eventName,{...t.properties,type:"experiment",variant:t.variant,timestamp:(new Date).toISOString()})}async define(t){return await this.init("experiment_defined",{type:"experiment",subtype:"definition",...t,timestamp:(new Date).toISOString()})}async assign(t){return await this.init("experiment_assigned",{type:"experiment",subtype:"assignment",experimentId:t.experimentId,userId:t.userId,variantId:t.variantId,source:t.source||"random",timestamp:(new Date).toISOString()})}async trackConversion(t){return await this.init("experiment_conversion",{type:"experiment",subtype:"conversion",experimentId:t.experimentId,userId:t.userId,variantId:t.variantId,metricName:t.metricName,value:t.value,timestamp:(new Date).toISOString()})}async trackExposure(t,e,a){return await this.init("experiment_exposure",{type:"experiment",subtype:"exposure",experimentId:t,userId:e,variantId:a,timestamp:(new Date).toISOString()})}async getResults(t){return await this.init("get_experiment_results",{type:"query",experimentId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_experiment_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}async getVariant(t,e){return await this.init("get_experiment_variant",{type:"query",experimentId:t,userId:e,timestamp:(new Date).toISOString()})}}class y extends p{async evaluate(t){return await this.init(t.eventName,{...t.properties,type:"feature_flag_evaluation",timestamp:(new Date).toISOString()})}async trackEvaluation(t){return await this.init("flag_evaluated",{type:"feature_flag_evaluation",flagKey:t.flagKey,userId:t.userId,context:t.context,result:t.result,reason:t.reason||"default",duration:t.duration,timestamp:(new Date).toISOString()})}async define(t){return await this.init("flag_defined",{...t,type:"feature_flag_definition",timestamp:(new Date).toISOString()})}async trackStatusChange(t,e,a){return await this.init("flag_status_changed",{type:"feature_flag_status",flagKey:t,enabled:e,changedBy:a,timestamp:(new Date).toISOString()})}async trackRolloutChange(t,e,a,i){return await this.init("flag_rollout_changed",{type:"feature_flag_rollout",flagKey:t,previousPercentage:e,newPercentage:a,changedBy:i,timestamp:(new Date).toISOString()})}}class l extends p{async track(t){return await this.init("page_view",{type:"page_view",url:t.url,path:t.path,title:t.title||"",referrer:t.referrer||"",userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackScrollDepth(t){return await this.init("scroll_depth",{type:"scroll_depth",path:t.path,scrollDepth:Math.min(100,Math.max(0,t.scrollDepth)),timeAtDepth:t.timeAtDepth,timestamp:(new Date).toISOString()})}async trackTimeOnPage(t){return await this.init("time_on_page",{type:"time_on_page",path:t.path,duration:t.duration,engaged:t.engaged??!1,timestamp:(new Date).toISOString()})}async trackExit(t,e,a){return await this.init("page_exit",{type:"page_exit",path:t,duration:e,scrollDepth:a,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_page_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}}class g extends p{async start(t={}){return await this.init("session_start",{type:"session_start",user:t.user,device:t.device,location:t.location,source:t.source||t.utm?.utmSource,medium:t.medium||t.utm?.utmMedium,campaign:t.campaign||t.utm?.utmCampaign,utm:t.utm,landingPage:t.landingPage||("undefined"!=typeof window?window.location.href:""),referrer:t.referrer||("undefined"!=typeof document?document.referrer:""),...t.properties,timestamp:(new Date).toISOString()})}async update(t,e){return await this.init("session_update",{type:"session_update",sessionId:t,...e,timestamp:(new Date).toISOString()})}async end(t){return await this.init("session_end",{type:"session_end",sessionId:t,timestamp:(new Date).toISOString()})}async heartbeat(t){return await this.init("session_heartbeat",{type:"session_heartbeat",sessionId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_session_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getRealTime(){return await this.init("get_realtime_sessions",{type:"query",realtime:!0,timestamp:(new Date).toISOString()})}}class I extends p{async track(t){return await this.init("custom_event",{type:"custom_event",eventName:t.eventName,category:t.category||"general",action:t.action,label:t.label,value:t.value,nonInteraction:t.nonInteraction||!1,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackBatch(t){const e=t.events.map(t=>({...t,timestamp:(new Date).toISOString()}));return await this.init("batch_events",{type:"batch_events",events:e,count:e.length,timestamp:(new Date).toISOString()})}async trackClick(t){return await this.init("click_event",{type:"click_event",...t,timestamp:(new Date).toISOString()})}async trackForm(t){return await this.init("form_event",{type:"form_event",...t,timestamp:(new Date).toISOString()})}async trackSearch(t){return await this.init("search_event",{type:"search_event",query:t.query,category:t.category,resultsCount:t.resultsCount,resultClicked:t.resultClicked,clickedPosition:t.clickedPosition,filters:t.filters,timestamp:(new Date).toISOString()})}async trackError(t){return await this.init("error_event",{type:"error_event",message:t.message,stack:t.stack,errorType:t.type,fatal:t.fatal||!1,context:t.context,userAction:t.userAction,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_event_analytics",{type:"query",filter:t||{range:"last30days"},pagination:e||{page:1,limit:50},timestamp:(new Date).toISOString()})}}class w extends p{async user(t){return await this.init("identify_user",{type:"identify",userId:t.userId,anonymousId:t.anonymousId,traits:t.traits||{},timestamp:(new Date).toISOString()})}async updateTraits(t,e){return await this.init("update_traits",{type:"update_traits",userId:t,traits:e,timestamp:(new Date).toISOString()})}async alias(t){return await this.init("alias_user",{type:"alias",previousId:t.previousId,userId:t.userId,timestamp:(new Date).toISOString()})}async group(t){return await this.init("group_user",{type:"group",userId:t.userId,groupId:t.groupId,traits:t.traits||{},timestamp:(new Date).toISOString()})}async reset(t){return await this.init("reset_identity",{type:"reset",userId:t,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_user_analytics",{type:"query",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class S extends p{async define(t){return await this.init("define_funnel",{type:"define_funnel",funnelId:t.funnelId,name:t.name,description:t.description,steps:t.steps,timestamp:(new Date).toISOString()})}async trackStep(t){return await this.init("funnel_step",{type:"funnel_step",funnelId:t.funnelId,step:t.step,stepNumber:t.stepNumber,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async trackComplete(t,e,a){return await this.init("funnel_complete",{type:"funnel_complete",funnelId:t,userId:e,...a,timestamp:(new Date).toISOString()})}async trackAbandon(t,e,a,i){return await this.init("funnel_abandon",{type:"funnel_abandon",funnelId:t,lastStep:e,userId:a,reason:i,timestamp:(new Date).toISOString()})}async analyze(t,e){return await this.init("analyze_funnel",{type:"query",funnelId:t,filter:e||{range:"last30days"},timestamp:(new Date).toISOString()})}async compare(t,e,a){return await this.init("compare_funnel",{type:"query",funnelId:t,baselineFilter:e,comparisonFilter:a,timestamp:(new Date).toISOString()})}async list(){return await this.init("list_funnels",{type:"query",timestamp:(new Date).toISOString()})}}class h extends p{async view(t){return await this.init("product_view",{type:"ecommerce",subtype:"product_view",product:{productId:t.productId,name:t.name,brand:t.brand,category:t.category,variant:t.variant,price:t.price,currency:t.currency,url:t.url,imageUrl:t.imageUrl,rating:t.rating,reviewCount:t.reviewCount,stockStatus:t.stockStatus,attributes:t.attributes},source:t.source,searchQuery:t.searchQuery,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async impression(t){return await this.init("product_impression",{type:"ecommerce",subtype:"product_impression",list:t.list,productCount:t.list.products.length,userId:t.userId,sessionId:t.sessionId,timestamp:(new Date).toISOString()})}async click(t){return await this.init("product_click",{type:"ecommerce",subtype:"product_click",product:t.product,listId:t.listId,position:t.position,userId:t.userId,timestamp:(new Date).toISOString()})}async quickView(t,e){return await this.init("product_quick_view",{type:"ecommerce",subtype:"product_quick_view",product:t,listId:e,timestamp:(new Date).toISOString()})}async interaction(t,e,a){return await this.init("product_interaction",{type:"ecommerce",subtype:"product_interaction",productId:t,action:e,...a,timestamp:(new Date).toISOString()})}async getAnalytics(t,e){return await this.init("get_product_analytics",{type:"ecommerce",subtype:"get_product_analytics",filter:t||{range:"last30days"},pagination:e||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getProductPerformance(t,e){return await this.init("get_product_performance",{type:"ecommerce",subtype:"get_product_performance",productId:t,filter:e||{range:"last30days"},timestamp:(new Date).toISOString()})}}class _ extends p{async addItem(t){const e=t.product.price*t.quantity-(t.product.discount||0);return await this.init("add_to_cart",{type:"ecommerce",subtype:"add_to_cart",product:t.product,quantity:t.quantity,lineTotal:e,cartId:t.cartId,userId:t.userId,source:t.source,...t.properties,timestamp:(new Date).toISOString()})}async removeItem(t){return await this.init("remove_from_cart",{type:"ecommerce",subtype:"remove_from_cart",product:t.product,quantity:t.quantity,cartId:t.cartId,userId:t.userId,reason:t.reason||"user_action",timestamp:(new Date).toISOString()})}async updateItem(t){return await this.init("update_cart_item",{type:"ecommerce",subtype:"update_cart_item",product:t.product,previousQuantity:t.previousQuantity,newQuantity:t.newQuantity,quantityChange:t.newQuantity-t.previousQuantity,cartId:t.cartId,timestamp:(new Date).toISOString()})}async view(t){return await this.init("view_cart",{type:"ecommerce",subtype:"view_cart",cart:t.cart,cartValue:t.cart.total,itemCount:t.cart.itemCount,userId:t.userId,timestamp:(new Date).toISOString()})}async abandon(t,e){return await this.init("cart_abandoned",{type:"ecommerce",subtype:"cart_abandoned",cart:t,cartValue:t.total,itemCount:t.itemCount,reason:e,timestamp:(new Date).toISOString()})}async applyCoupon(t,e,a,i){return await this.init("apply_coupon",{type:"ecommerce",subtype:"apply_coupon",cartId:t,couponCode:e,success:a,discount:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_cart_analytics",{type:"ecommerce",subtype:"get_cart_analytics",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class f extends p{async begin(t){return await this.init("begin_checkout",{type:"ecommerce",subtype:"begin_checkout",cart:t.cart,cartValue:t.cart.total,itemCount:t.cart.itemCount,userId:t.userId,sessionId:t.sessionId,...t.properties,timestamp:(new Date).toISOString()})}async step(t){return await this.init("checkout_step",{type:"ecommerce",subtype:"checkout_step",step:t.step,stepNumber:t.stepNumber,cart:t.cart,option:t.option,userId:t.userId,timestamp:(new Date).toISOString()})}async addShipping(t){return await this.init("add_shipping_info",{type:"ecommerce",subtype:"shipping_info",cart:t.cart,shipping:t.shipping,shippingMethod:t.shipping.method,shippingCost:t.shipping.cost,userId:t.userId,timestamp:(new Date).toISOString()})}async addPayment(t){return await this.init("add_payment_info",{type:"ecommerce",subtype:"payment_info",cart:t.cart,payment:t.payment,paymentMethod:t.payment.method,userId:t.userId,timestamp:(new Date).toISOString()})}async abandon(t,e,a){return await this.init("checkout_abandoned",{type:"ecommerce",subtype:"checkout_abandoned",cart:t,step:e,cartValue:t.total,reason:a,timestamp:(new Date).toISOString()})}async paymentAttempt(t,e,a,i){return await this.init("payment_attempt",{type:"ecommerce",subtype:"payment_attempt",success:t,cart:e,payment:a,errorCode:i,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_checkout_analytics",{type:"ecommerce",subtype:"checkout_analytics",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}}class b extends p{async track(t){const e=t.order;return await this.init("purchase",{type:"ecommerce",subtype:"purchase",order:{orderId:e.orderId,items:e.items,subtotal:e.subtotal,discountTotal:e.discountTotal,shippingTotal:e.shippingTotal,taxTotal:e.taxTotal,total:e.total,currency:e.currency,shipping:e.shipping,payment:e.payment,coupons:e.coupons,affiliation:e.affiliation},revenue:e.total,itemCount:e.items.reduce((t,e)=>t+e.quantity,0),userId:t.userId,sessionId:t.sessionId,attribution:t.attribution,...t.properties,timestamp:(new Date).toISOString()})}async statusChange(t,e,a){return await this.init("order_status_change",{type:"ecommerce",subtype:"order_status_change",orderId:t,newStatus:e,previousStatus:a,timestamp:(new Date).toISOString()})}async shipped(t,e){return await this.init("order_shipped",{type:"ecommerce",subtype:"order_shipped",orderId:t,shipping:e,timestamp:(new Date).toISOString()})}async delivered(t,e){return await this.init("order_delivered",{type:"ecommerce",subtype:"order_delivered",orderId:t,deliveredAt:e||(new Date).toISOString(),timestamp:(new Date).toISOString()})}async getRevenue(t){return await this.init("get_revenue_analytics",{type:"ecommerce",subtype:"get_revenue_analytics",filter:t||{range:"last30days"},timestamp:(new Date).toISOString()})}async getRecentOrders(t){return await this.init("get_recent_orders",{type:"ecommerce",subtype:"get_recent_orders",pagination:t||{page:1,limit:20},timestamp:(new Date).toISOString()})}async getOrder(t){return await this.init("get_order",{type:"ecommerce",subtype:"get_order",orderId:t,timestamp:(new Date).toISOString()})}}class v extends p{async getCustomerValue(t){return await this.init("get_customer_value",{type:"ecommerce",subtype:"get_customer_value",userId:t,timestamp:(new Date).toISOString()})}async recordAcquisitionCost(t){return await this.init("record_acquisition_cost",{type:"ecommerce",subtype:"acquisition_cost",userId:t.userId,cost:t.cost,channel:t.channel,campaign:t.campaign,timestamp:(new Date).toISOString()})}async updateSegment(t,e){return await this.init("update_customer_segment",{type:"ecommerce",subtype:"update_customer_segment",userId:t,segment:e,timestamp:(new Date).toISOString()})}async getTopCustomers(t=100){return await this.init("get_top_customers",{type:"ecommerce",subtype:"get_top_customers",limit:t,sortBy:"totalRevenue",sortOrder:"desc",timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_ltv_analytics",{type:"ecommerce",subtype:"get_ltv_analytics",filter:t||{range:"last90days"},timestamp:(new Date).toISOString()})}}class O extends p{async start(t){return await this.init("subscription_start",{type:"ecommerce",subtype:"subscription_start",subscriptionId:t.subscriptionId,userId:t.userId,plan:t.plan,mrr:t.mrr,billingCycle:t.billingCycle,trialDays:t.trialDays,coupon:t.coupon,isTrialing:(t.trialDays||0)>0,...t.properties,timestamp:(new Date).toISOString()})}async change(t){const e=t.newMrr.amount-t.previousMrr.amount;return await this.init("subscription_change",{type:"ecommerce",subtype:"subscription_change",subscriptionId:t.subscriptionId,userId:t.userId,previousPlan:t.previousPlan,newPlan:t.newPlan,previousMrr:t.previousMrr,newMrr:t.newMrr,mrrChange:e,changeType:t.changeType,timestamp:(new Date).toISOString()})}async cancel(t){return await this.init("subscription_cancel",{type:"ecommerce",subtype:"subscription_cancel",subscriptionId:t.subscriptionId,userId:t.userId,plan:t.plan,lostMrr:t.lostMrr,reason:t.reason,feedback:t.feedback,immediate:t.immediate,timestamp:(new Date).toISOString()})}async renew(t,e,a){return await this.init("subscription_renew",{type:"ecommerce",subtype:"subscription_renew",subscriptionId:t,userId:e,mrr:a,timestamp:(new Date).toISOString()})}async trialConverted(t,e,a,i){return await this.init("trial_converted",{type:"ecommerce",subtype:"trial_converted",subscriptionId:t,userId:e,plan:a,mrr:i,timestamp:(new Date).toISOString()})}async trialExpired(t,e){return await this.init("trial_expired",{type:"ecommerce",subtype:"trial_expired",subscriptionId:t,userId:e,timestamp:(new Date).toISOString()})}async getAnalytics(t){return await this.init("get_subscription_analytics",{type:"ecommerce",subtype:"get_subscription_analytics",filter:t||{range:"thisMonth"},timestamp:(new Date).toISOString()})}}s(272);var D=s(12);let x,k;(0,D.createContext)(null),s(594),Symbol("FlowGrid");try{const t=s(500);x=t.usePathname,k=t.useSearchParams}catch{x=()=>"undefined"!=typeof window?window.location.pathname:"/",k=()=>"undefined"!=typeof window?new URLSearchParams(window.location.search):new URLSearchParams}return(0,D.createContext)(null),o.default})());
2
2
  //# sourceMappingURL=index.js.map