@widgetic/creator 0.3.71 → 0.3.72

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.
@@ -891,6 +891,16 @@
891
891
  let currentGenerationOperationId: string | null = null;
892
892
  let generateCodeStatus: string | null = null;
893
893
  let lastGenerationFailed = false; // Track if last generation failed for retry UI
894
+ let publishPlanMessageByWidgetId: Record<string, string> = {};
895
+
896
+ function isPlanLimitMessage(message: string | null | undefined): boolean {
897
+ if (!message) return false;
898
+ return /credit balance|free trial|not available in your plan|not available on the free plan|upgrade your plan|upgrade to a solo/i.test(message);
899
+ }
900
+
901
+ function openUpgradePlans() {
902
+ window.location.assign('/workspaces/personal/settings/billing');
903
+ }
894
904
  let lastGenerationError: string | null = null; // Store the error message for display
895
905
  let lastGenerationPrompt: string | null = null; // Last prompt used, for retrying failed generations
896
906
  let pendingAutoGenerateWidgetId: string | null = null; // Widget created from canvas that needs auto code generation
@@ -8649,7 +8659,7 @@ Requirements:
8649
8659
  duration: 8000
8650
8660
  });
8651
8661
  }
8652
- } else if (promptImpliesVisionReference(prompt)) {
8662
+ } else if (promptImpliesVisionReference(prompt) && !options.forkUserMessage) {
8653
8663
  showToast('warning', 'Generare fără imagine', {
8654
8664
  description:
8655
8665
  'Request-ul merge fără vision (DeepSeek etc.). Atașează PNG/JPEG în chat înainte de Send.',
@@ -9548,10 +9558,18 @@ Requirements:
9548
9558
  isPublishing = false;
9549
9559
  publishingWidgetId = null;
9550
9560
  setCrossTabPublishing(false, capturedWidgetId);
9551
- showToast('error', 'Publish failed', {
9552
- description: normalizeErrorMessage(err) || 'An unexpected error occurred. Please try again.',
9553
- duration: 8000
9554
- });
9561
+ const publishErrorText = normalizeErrorMessage(err) || 'An unexpected error occurred. Please try again.';
9562
+ if (isPlanLimitMessage(publishErrorText) && capturedWidgetId) {
9563
+ publishPlanMessageByWidgetId = {
9564
+ ...publishPlanMessageByWidgetId,
9565
+ [capturedWidgetId]: publishErrorText,
9566
+ };
9567
+ } else {
9568
+ showToast('error', 'Publish failed', {
9569
+ description: publishErrorText,
9570
+ duration: 8000
9571
+ });
9572
+ }
9555
9573
  }
9556
9574
  // isPublishing stays true until widget_publish_status WebSocket event arrives (success or failure)
9557
9575
  }
@@ -16008,10 +16026,47 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
16008
16026
  {/if}
16009
16027
  </div>
16010
16028
  </div>
16029
+ {#if publishPlanMessageByWidgetId[panelWidgetId]}
16030
+ <div class="publish-plan-notice p-3 bg-red-50 border border-red-200" style="border-radius: 0;">
16031
+ <p class="text-xs text-red-700 whitespace-pre-wrap">{publishPlanMessageByWidgetId[panelWidgetId]}</p>
16032
+ <div class="flex gap-2 mt-3 justify-center">
16033
+ <Button
16034
+ onclick={openUpgradePlans}
16035
+ variant="default"
16036
+ size="sm"
16037
+ class="bg-red-600 hover:bg-red-700 text-white rounded-lg"
16038
+ >
16039
+ Upgrade
16040
+ </Button>
16041
+ <Button
16042
+ onclick={() => {
16043
+ const next = { ...publishPlanMessageByWidgetId };
16044
+ delete next[panelWidgetId];
16045
+ publishPlanMessageByWidgetId = next;
16046
+ }}
16047
+ variant="outline"
16048
+ size="sm"
16049
+ class="border-gray-300 text-gray-600 hover:bg-gray-50 rounded-lg"
16050
+ >
16051
+ Dismiss
16052
+ </Button>
16053
+ </div>
16054
+ </div>
16055
+ {/if}
16011
16056
  {#if ps.lastGenerationFailed}
16012
16057
  <div class="p-3 bg-red-50 border border-red-200" style="border-radius: 0;">
16013
16058
  <p class="text-xs text-red-700 whitespace-pre-wrap">{ps.lastGenerationError}</p>
16014
16059
  <div class="flex gap-2 mt-3 justify-center">
16060
+ {#if isPlanLimitMessage(ps.lastGenerationError)}
16061
+ <Button
16062
+ onclick={openUpgradePlans}
16063
+ variant="default"
16064
+ size="sm"
16065
+ class="bg-red-600 hover:bg-red-700 text-white rounded-lg"
16066
+ >
16067
+ Upgrade
16068
+ </Button>
16069
+ {:else}
16015
16070
  <Button
16016
16071
  onclick={() => {
16017
16072
  if (!isPanelFocused) focusWidgetPanel(panelWidgetId);
@@ -16026,6 +16081,7 @@ $: if (codeGenerationPrompt && selectedWidgetId && promptLoadedForWidgetId === s
16026
16081
  >
16027
16082
  Retry
16028
16083
  </Button>
16084
+ {/if}
16029
16085
  <Button
16030
16086
  onclick={() => {
16031
16087
  if (!isPanelFocused) focusWidgetPanel(panelWidgetId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/creator",
3
- "version": "0.3.71",
3
+ "version": "0.3.72",
4
4
  "type": "module",
5
5
  "peerDependencies": {
6
6
  "@sveltejs/kit": "^2.20.0",