@designcrowd/library.brand-page 5.16.7 → 5.16.8

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.
Files changed (23) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-wW2pGdd1.js → CreatedOnBrandCrowd-de-de-BIOe-8IA.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-CBT4P6g7.js → CreatedOnBrandCrowd-en-us-DV20bca1.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-BnF7sK_H.js → CreatedOnBrandCrowd-es-es-DKqBeyh-.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-DX9xl_Ha.js → CreatedOnBrandCrowd-fr-ca-BzxDd-OM.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-DX9xl_Ha.js → CreatedOnBrandCrowd-fr-fr-BzxDd-OM.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-C0PsAWrw.js → CreatedOnBrandCrowd-pt-br-B1jO4ynE.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-C0PsAWrw.js → CreatedOnBrandCrowd-pt-pt-B1jO4ynE.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-OtYDdIlh.js → CreatedOnDcom-de-de-Dbz_XUoY.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-gV7rV48U.js → CreatedOnDcom-en-us-C5klzL2y.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-CDnlL9E_.js → CreatedOnDcom-es-es-CP1DRQVG.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-BvPz_3hN.js → CreatedOnDcom-fr-ca-Dh-kd_pp.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-C8TnTmNZ.js → CreatedOnDcom-fr-fr-DP2Sztda.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-qB9SGJDP.js → CreatedOnDcom-pt-br-C8n0YKop.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-D9_4i33m.js → CreatedOnDcom-pt-pt-DqGJHyCL.js} +1 -1
  15. package/lib/src/css/library.brand-page-brandCrowd.min.css +20 -20
  16. package/lib/src/css/library.brand-page-brandPage.min.css +20 -20
  17. package/lib/src/css/library.brand-page-designCom.min.css +20 -20
  18. package/lib/src/css/library.brand-page-preview.min.css +20 -20
  19. package/lib/src/index.mjs +1 -1
  20. package/lib/src/{lib-4panOoXa.js → lib-CaUOFYrW.js} +2762 -2765
  21. package/package.json +1 -1
  22. package/src/shared/content-settings/components/generate-ai-button/GenerateAiButton.vue +7 -14
  23. package/src/shared/content-settings/components/generate-ai-modal/GenerateAiModal.vue +16 -4
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@designcrowd/library.brand-page",
3
3
  "description": "A collection of Maker/Designer applications",
4
- "version": "5.16.7",
4
+ "version": "5.16.8",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -15,7 +15,6 @@
15
15
  :is-visible="generateTextModalVisible"
16
16
  :existing-text="props.existingText"
17
17
  :is-design-com="props.isDesignCom"
18
- :snapshot-base64="snapshotBase64"
19
18
  :field-type="props.fieldType"
20
19
  @on-close="onCloseGenerateTextModal"
21
20
  @on-use-text="handleUseGeneratedText"
@@ -52,10 +51,9 @@ const emit = defineEmits<{
52
51
  'capture-snapshot': [];
53
52
  }>();
54
53
 
55
- const snapshotStore = useSnapshotStore();
56
54
  const brandPageContainerStore = useBrandPageContainerStore();
55
+ const snapshotStore = useSnapshotStore();
57
56
 
58
- const snapshotBase64 = computed(() => snapshotStore.snapshotBase64);
59
57
  const abTests = computed(() => brandPageContainerStore.abTests);
60
58
 
61
59
  const showButton = computed(() => {
@@ -69,19 +67,14 @@ const showButton = computed(() => {
69
67
  const generateTextModalVisible = ref(false);
70
68
  const generateText = commonTr('generateText');
71
69
 
72
- const onShowGenerateModal = async () => {
73
- emit('capture-snapshot');
74
-
75
- const maxWaitTime = 5000; // 5 seconds max
76
- const pollInterval = 50; // Check every 50ms
77
- let elapsedTime = 0;
78
-
79
- while (!snapshotBase64.value && elapsedTime < maxWaitTime) {
80
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
81
- elapsedTime += pollInterval;
82
- }
70
+ const onShowGenerateModal = () => {
71
+ snapshotStore.clearSnapshot();
83
72
 
84
73
  generateTextModalVisible.value = true;
74
+
75
+ setTimeout(() => {
76
+ emit('capture-snapshot');
77
+ }, 50);
85
78
  };
86
79
 
87
80
  const onCloseGenerateTextModal = () => {
@@ -162,11 +162,11 @@ import {
162
162
  commonTr,
163
163
  } from '../../../../composables/useTranslate';
164
164
  import { getInstance as getDesignTemplateClient } from '../../../../clients/design-template-client';
165
+ import { useSnapshotStore } from '../../../../brand-page-maker/stores';
165
166
 
166
167
  interface Props {
167
168
  isVisible: boolean;
168
169
  existingText?: string;
169
- snapshotBase64?: string | null;
170
170
  isDesignCom?: boolean;
171
171
  fieldType?: string;
172
172
  }
@@ -174,7 +174,6 @@ interface Props {
174
174
  const props = withDefaults(defineProps<Props>(), {
175
175
  isVisible: true,
176
176
  existingText: '',
177
- snapshotBase64: null,
178
177
  fieldType: 'text',
179
178
  });
180
179
 
@@ -193,6 +192,9 @@ const data = reactive({
193
192
  const textareaRef = ref<HTMLTextAreaElement | null>(null);
194
193
  const MAX_PROMPT_LENGTH = 500;
195
194
 
195
+ const snapshotStore = useSnapshotStore();
196
+ const snapshotBase64 = computed(() => snapshotStore.snapshotBase64);
197
+
196
198
  // Auto-resize textarea
197
199
  const resizeTextarea = () => {
198
200
  if (textareaRef.value) {
@@ -354,11 +356,21 @@ const onSendPrompt = async (customPrompt?: string) => {
354
356
  clearTypingInterval();
355
357
 
356
358
  try {
359
+ const maxWaitTime = 5000;
360
+ const pollInterval = 50;
361
+ let elapsedTime = 0;
362
+
363
+ // Wait for snapshot to be captured (triggered by button component)
364
+ while (!snapshotBase64.value && elapsedTime < maxWaitTime) {
365
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
366
+ elapsedTime += pollInterval;
367
+ }
368
+
357
369
  const client = getDesignTemplateClient();
358
370
  const result = await client.generateText(
359
371
  promptToSend,
360
372
  props.existingText ?? '',
361
- props.snapshotBase64 || undefined,
373
+ snapshotBase64.value || undefined,
362
374
  );
363
375
 
364
376
  // Check if generation was stopped before setting response
@@ -415,7 +427,7 @@ watch(
415
427
  data.isTyping = false;
416
428
  }
417
429
  },
418
- { flush: 'sync' }, // Execute synchronously to prevent race conditions
430
+ { flush: 'sync' },
419
431
  );
420
432
 
421
433
  onUnmounted(clearTypingInterval);