@fayz-ai/plugin-getting-started 0.2.0-canary.20261028153856 → 0.2.0

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.
@@ -555,14 +555,18 @@ function mapMinimums(raw) {
555
555
  }
556
556
  function mapJourney(raw) {
557
557
  const phase = str(raw.phase);
558
+ const known = phase === "trial" || phase === "expired" || phase === "converted" ? phase : "setup";
559
+ const trialStartedAt = str(raw.trial_started_at);
558
560
  return {
559
561
  tenantId: String(raw.tenant_id ?? ""),
560
- phase: phase === "trial" || phase === "expired" || phase === "converted" ? phase : "setup",
562
+ // A pool without migration 007 still calls a lapsed signup date "expired" and
563
+ // a setup deadline; the trial counts only from "Iniciar teste", so neither holds.
564
+ phase: known === "expired" && !trialStartedAt ? "setup" : known,
561
565
  trialDays: Number(raw.trial_days ?? 0) || 0,
562
566
  readyAt: str(raw.ready_at),
563
- trialStartedAt: str(raw.trial_started_at),
567
+ trialStartedAt,
564
568
  trialEndsAt: str(raw.trial_ends_at),
565
- setupDeadlineAt: str(raw.setup_deadline_at),
569
+ setupDeadlineAt: null,
566
570
  convertedAt: str(raw.converted_at),
567
571
  wantsContractAt: str(raw.wants_contract_at),
568
572
  source: str(raw.source),
@@ -632,20 +636,22 @@ var DAY_MS = 864e5;
632
636
  var isoDay = (d) => d.toISOString().slice(0, 10);
633
637
  function derivePhase(input) {
634
638
  if (input.convertedAt) return "converted";
639
+ if (!input.trialStartedAt) return "setup";
635
640
  if (input.trialEndsAt && new Date(input.trialEndsAt).getTime() <= input.now.getTime()) return "expired";
636
- if (input.trialStartedAt) return "trial";
637
- return "setup";
641
+ return "trial";
638
642
  }
639
643
  function createMockGettingStartedProvider(options = {}) {
640
644
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
641
645
  const tenantId = options.tenantId ?? "mock-tenant";
642
646
  const trialDays = options.trialDays ?? 14;
643
647
  const createdAt = now();
648
+ const endedAgo = options.trialEndedDaysAgo;
649
+ const ended = endedAgo === void 0 ? null : new Date(createdAt.getTime() - endedAgo * DAY_MS);
644
650
  const state = {
645
- trialEndsAt: new Date(createdAt.getTime() + (options.setupWindowDays ?? 30) * DAY_MS).toISOString(),
646
- readyAt: null,
647
- trialStartedAt: null,
648
- trialDays: null,
651
+ trialEndsAt: ended ? ended.toISOString() : null,
652
+ readyAt: ended ? new Date(ended.getTime() - trialDays * DAY_MS).toISOString() : null,
653
+ trialStartedAt: ended ? new Date(ended.getTime() - trialDays * DAY_MS).toISOString() : null,
654
+ trialDays: ended ? trialDays : null,
649
655
  convertedAt: null,
650
656
  wantsContractAt: null,
651
657
  minimums: { menu: false, hours: false, testOrder: false, ...options.minimums },
@@ -680,7 +686,7 @@ function createMockGettingStartedProvider(options = {}) {
680
686
  readyAt: state.readyAt,
681
687
  trialStartedAt: state.trialStartedAt,
682
688
  trialEndsAt: state.trialEndsAt,
683
- setupDeadlineAt: state.trialStartedAt ? null : state.trialEndsAt,
689
+ setupDeadlineAt: null,
684
690
  convertedAt: state.convertedAt,
685
691
  wantsContractAt: state.wantsContractAt,
686
692
  source: null,
@@ -3017,5 +3023,5 @@ var gettingStartedLocales = {
3017
3023
  };
3018
3024
 
3019
3025
  export { CARD_ANCHOR, DEFAULT_ROUTES, DELIVERY_METHODS, GettingStartedError, JOURNEY_TOUR_ID, MINIMUM_IDS, OPERATIONS, PROFILE_KEYS, PROGRAM_ID, ProgressRing, RPC, SAVE_PROFILE_TOOL, SENSOR_RULED_KEYS, SERVICE_MODES, STORE_PROFILE_STEP_KEY, STORE_SETTINGS_SAVED_EVENT, StartTrialAction, StartTrialCta, StoreLiveCard, T, TABLE_BANDS, TRIAL_TAB_ANCHOR, TrialEndBanner, TrialSettingsTab, WEEKDAYS, buildJourneyClosingStop, buildJourneyTour, buildOwnJourneyTour, buildStoreLiveProgram, businessProfileStoreProfileProvider, clientJourney, configureStoreProfile, configureStoreSettings, countJourney, countMinimums, createMockGettingStartedProvider, createSupabaseGettingStartedProvider, currentJourney, declareJourney, derivePhase, formatEndTime, formatTrialDate, getActiveConfig, getStoreProfileProvider, getStoreSettingsProvider, gettingStartedAiTools, gettingStartedAiToolsFor, gettingStartedLocales, hasOpeningHours, hasPaymentMethods, isForbidden, isMissingClock, journeyTour, loadStoreSettings, minimumLines, minimumSlotOf, noteTrialDaysDivergence, nowStepKey, readStoreSettings, registerGettingStartedToolHandlers, resolveConfig, resolveRoutes, rowDone, saveStoreSetting, selectJourneySteps, setActiveConfig, setHostJourneyPrograms, setJourneyOverride, startJourneyTour, storeProfileAnswered, storeProfileFrom, storeProfileFromAnswers, storeProfileToAnswers, storeSetupRouting, supabaseStoreSettingsProvider, toStepInputs, toTrialSource, trialEndsToday, useJourneyDeclaration, useJourneyStore, useJourneyTourStore, useStartTrial, withGettingStartedContext, withJourneyDeclaration, withoutStoreProfileStep };
3020
- //# sourceMappingURL=chunk-IDU6T6QU.js.map
3021
- //# sourceMappingURL=chunk-IDU6T6QU.js.map
3026
+ //# sourceMappingURL=chunk-4ATBLO6S.js.map
3027
+ //# sourceMappingURL=chunk-4ATBLO6S.js.map