@adminide-stack/yantra-mobile 12.0.166 → 12.0.167

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 (134) hide show
  1. package/lib/assets/kinds/character.webp +0 -0
  2. package/lib/assets/kinds/image.webp +0 -0
  3. package/lib/assets/kinds/video.webp +0 -0
  4. package/lib/assets/kinds/website.webp +0 -0
  5. package/lib/bridge/handlers/NavigationBridgeHandler.js +3 -2
  6. package/lib/bridge/handlers/NavigationBridgeHandler.js.map +1 -1
  7. package/lib/components/CustomDrawer.js +6 -2
  8. package/lib/components/CustomDrawer.js.map +1 -1
  9. package/lib/features/agent-chat/NativeAgentChat.js +17 -3
  10. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  11. package/lib/features/chat/ApprovalCard.js +8 -2
  12. package/lib/features/chat/ApprovalCard.js.map +1 -1
  13. package/lib/features/chat/AskUserCard.js +5 -3
  14. package/lib/features/chat/AskUserCard.js.map +1 -1
  15. package/lib/features/chat/ComposerModeSwitch.js +147 -0
  16. package/lib/features/chat/ComposerModeSwitch.js.map +1 -0
  17. package/lib/features/templates/__tests__/buildKinds.test.ts +54 -0
  18. package/lib/features/templates/__tests__/buildTemplateCards.test.ts +58 -6
  19. package/lib/features/templates/__tests__/templateSuggestion.test.ts +30 -0
  20. package/lib/features/templates/buildKinds.js +114 -0
  21. package/lib/features/templates/buildKinds.js.map +1 -0
  22. package/lib/features/templates/buildKinds.ts +189 -0
  23. package/lib/features/templates/buildTemplateCards.js +63 -18
  24. package/lib/features/templates/buildTemplateCards.js.map +1 -1
  25. package/lib/features/templates/buildTemplateCards.ts +88 -18
  26. package/lib/features/templates/index.ts +2 -0
  27. package/lib/features/templates/templateSuggestion.js +34 -0
  28. package/lib/features/templates/templateSuggestion.js.map +1 -0
  29. package/lib/features/templates/templateSuggestion.ts +57 -0
  30. package/lib/features/webbuilder/WebBuilderExperience.js +188 -28
  31. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  32. package/lib/features/webbuilder/approvalsLink.js +6 -0
  33. package/lib/features/webbuilder/approvalsLink.js.map +1 -0
  34. package/lib/features/webbuilder/buildFragments.js +19 -4
  35. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  36. package/lib/features/webbuilder/components/CloudSheet.js +18 -5
  37. package/lib/features/webbuilder/components/CloudSheet.js.map +1 -1
  38. package/lib/features/webbuilder/components/CodeView.js +7 -3
  39. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  40. package/lib/features/webbuilder/components/DomainFinder.js +263 -0
  41. package/lib/features/webbuilder/components/DomainFinder.js.map +1 -0
  42. package/lib/features/webbuilder/components/DraftsSheet.js +298 -0
  43. package/lib/features/webbuilder/components/DraftsSheet.js.map +1 -0
  44. package/lib/features/webbuilder/components/ImageEditPanel.js +266 -0
  45. package/lib/features/webbuilder/components/ImageEditPanel.js.map +1 -0
  46. package/lib/features/webbuilder/components/MentionMenu.js +155 -0
  47. package/lib/features/webbuilder/components/MentionMenu.js.map +1 -0
  48. package/lib/features/webbuilder/components/NotesSheet.js +138 -0
  49. package/lib/features/webbuilder/components/NotesSheet.js.map +1 -0
  50. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  51. package/lib/features/webbuilder/components/ProjectChat.js +17 -3
  52. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  53. package/lib/features/webbuilder/components/PublishSheet.js +200 -15
  54. package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
  55. package/lib/features/webbuilder/components/ShareSheet.js +48 -6
  56. package/lib/features/webbuilder/components/ShareSheet.js.map +1 -1
  57. package/lib/features/webbuilder/components/SiteCopyProgress.js +169 -0
  58. package/lib/features/webbuilder/components/SiteCopyProgress.js.map +1 -0
  59. package/lib/features/webbuilder/components/SiteStatusSheet.js +145 -2
  60. package/lib/features/webbuilder/components/SiteStatusSheet.js.map +1 -1
  61. package/lib/features/webbuilder/drafts.js +167 -0
  62. package/lib/features/webbuilder/drafts.js.map +1 -0
  63. package/lib/features/webbuilder/maskPng.js +113 -0
  64. package/lib/features/webbuilder/maskPng.js.map +1 -0
  65. package/lib/features/webbuilder/previewProbe.js.map +1 -1
  66. package/lib/features/webbuilder/stepLabels.js +21 -1
  67. package/lib/features/webbuilder/stepLabels.js.map +1 -1
  68. package/lib/features/webbuilder/web/chat/mentions.js +106 -0
  69. package/lib/features/webbuilder/web/chat/mentions.js.map +1 -0
  70. package/lib/features/webbuilder/web/chat/siteCopy.js +121 -0
  71. package/lib/features/webbuilder/web/chat/siteCopy.js.map +1 -0
  72. package/lib/features/webbuilder/web/code/imageEdit.js +30 -0
  73. package/lib/features/webbuilder/web/code/imageEdit.js.map +1 -0
  74. package/lib/features/webbuilder/web/design/linkedDesign.js +26 -0
  75. package/lib/features/webbuilder/web/design/linkedDesign.js.map +1 -0
  76. package/lib/features/webbuilder/web/project/buildLink.js +3 -0
  77. package/lib/features/webbuilder/web/project/buildLink.js.map +1 -0
  78. package/lib/features/webbuilder/web/project/drafts.js +57 -0
  79. package/lib/features/webbuilder/web/project/drafts.js.map +1 -0
  80. package/lib/features/webbuilder/web/project/navHistory.js +7 -0
  81. package/lib/features/webbuilder/web/project/navHistory.js.map +1 -0
  82. package/lib/features/webbuilder/web/project/serverSettings.js +15 -4
  83. package/lib/features/webbuilder/web/project/serverSettings.js.map +1 -1
  84. package/lib/features/webbuilder/web/publish/domainShop.js +79 -0
  85. package/lib/features/webbuilder/web/publish/domainShop.js.map +1 -0
  86. package/lib/features/webbuilder/web/publish/publishRequest.js +11 -0
  87. package/lib/features/webbuilder/web/publish/publishRequest.js.map +1 -0
  88. package/lib/features/webbuilder/web/publish/review/freshness.js +13 -0
  89. package/lib/features/webbuilder/web/publish/review/freshness.js.map +1 -0
  90. package/lib/features/webbuilder/web/publish/review/ignores.js +94 -0
  91. package/lib/features/webbuilder/web/publish/review/ignores.js.map +1 -0
  92. package/lib/features/webbuilder/web/publish/review/seo.js +230 -0
  93. package/lib/features/webbuilder/web/publish/review/seo.js.map +1 -0
  94. package/lib/features/webbuilder/web/publish/siteHealth.js +27 -3
  95. package/lib/features/webbuilder/web/publish/siteHealth.js.map +1 -1
  96. package/lib/features/webbuilder/web/publish/siteInsights.js +120 -3
  97. package/lib/features/webbuilder/web/publish/siteInsights.js.map +1 -1
  98. package/lib/features/webbuilder/web/sharing/shareLink.js +9 -0
  99. package/lib/features/webbuilder/web/sharing/shareLink.js.map +1 -0
  100. package/lib/features/webbuilder/web/webServices.js +1 -1
  101. package/lib/features/webbuilder/web/webServices.js.map +1 -1
  102. package/lib/hooks/useMarketplaceTemplateCards.js +3 -4
  103. package/lib/hooks/useMarketplaceTemplateCards.js.map +1 -1
  104. package/lib/hooks/useMarketplaceTemplateGroups.js +12 -5
  105. package/lib/hooks/useMarketplaceTemplateGroups.js.map +1 -1
  106. package/lib/hooks/useTemplatesResourceUri.js +12 -0
  107. package/lib/hooks/useTemplatesResourceUri.js.map +1 -0
  108. package/lib/screens/Chat/index.js +4 -22
  109. package/lib/screens/Chat/index.js.map +1 -1
  110. package/lib/screens/Home/HomeScreen.js +165 -179
  111. package/lib/screens/Home/HomeScreen.js.map +1 -1
  112. package/lib/screens/Home/components/BuildKindPicker.js +248 -0
  113. package/lib/screens/Home/components/BuildKindPicker.js.map +1 -0
  114. package/lib/screens/Home/components/BuildTemplatesSection.js +556 -117
  115. package/lib/screens/Home/components/BuildTemplatesSection.js.map +1 -1
  116. package/lib/screens/Home/components/KindThumb.js +444 -0
  117. package/lib/screens/Home/components/KindThumb.js.map +1 -0
  118. package/lib/screens/Home/components/TemplateSuggestionBanner.js +73 -0
  119. package/lib/screens/Home/components/TemplateSuggestionBanner.js.map +1 -0
  120. package/lib/screens/Home/components/buildTheme.js +68 -0
  121. package/lib/screens/Home/components/buildTheme.js.map +1 -0
  122. package/lib/screens/WebBuilder/index.js +11 -1
  123. package/lib/screens/WebBuilder/index.js.map +1 -1
  124. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +55 -0
  125. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -0
  126. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +4 -0
  127. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -1
  128. package/lib/screens/WebBuilderNative/index.js +31 -4
  129. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  130. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +1 -0
  131. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  132. package/lib/screens/WebBuilderNative/webbuilderTransport.js +5 -5
  133. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  134. package/package.json +3 -3
@@ -1,14 +1,188 @@
1
- import {jsxs,jsx}from'react/jsx-runtime';import {useState,useMemo,useCallback}from'react';import {StyleSheet,useWindowDimensions,Pressable,View,Image,ScrollView}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Text}from'@admin-layout/gluestack-ui-mobile';import {useMarketplaceTemplateCards}from'../../../hooks/useMarketplaceTemplateCards.js';import {mobileTokens}from'../../../theme/mobileTokens.js';import {TemplateBrowserModal}from'./TemplateBrowserModal.js';const FEATURED_COUNT = 8;
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {useState,useMemo,useCallback}from'react';import {StyleSheet,useWindowDimensions,View,Pressable,ActivityIndicator,Image}from'react-native';import {Feather,Ionicons}from'@expo/vector-icons';import {Text}from'@admin-layout/gluestack-ui-mobile';import {useMarketplaceTemplateCards}from'../../../hooks/useMarketplaceTemplateCards.js';import {BUILD_SHADOW,Fade,BUILD_SERIF}from'./buildTheme.js';import {TemplateBrowserModal}from'./TemplateBrowserModal.js';var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const FEATURED_COUNT = 8;
21
+ const GRID_GAP = 12;
22
+ const WAVE = Array.from({
23
+ length: 22
24
+ }, (_, index) => index);
25
+ function waveHeight(index) {
26
+ const n = index + 1;
27
+ if (n % 7 === 0) return "60%";
28
+ if (n % 5 === 0) return "100%";
29
+ if (n % 4 === 0) return "26%";
30
+ if (n % 3 === 0) return "78%";
31
+ return "40%";
32
+ }
33
+ function DrawnCover({
34
+ kind,
35
+ title,
36
+ palette
37
+ }) {
38
+ const sheet = [styles.sheet, {
39
+ backgroundColor: palette.sheet
40
+ }];
41
+ const serif = [styles.gTitle, {
42
+ color: palette.sheetInk,
43
+ fontFamily: BUILD_SERIF
44
+ }];
45
+ switch (kind) {
46
+ case "website":
47
+ return /* @__PURE__ */ jsx(View, { style: [styles.g, styles.gLow], children: /* @__PURE__ */ jsxs(View, { style: [sheet, styles.gWin], children: [
48
+ /* @__PURE__ */ jsx(View, { style: styles.gBar, children: [0, 1, 2].map((dot) => /* @__PURE__ */ jsx(View, { style: styles.gBarDot }, dot)) }),
49
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 3, style: [serif, styles.gInset], children: title }),
50
+ /* @__PURE__ */ jsx(View, { style: [styles.gLine, styles.gInset] })
51
+ ] }) });
52
+ case "app":
53
+ return /* @__PURE__ */ jsx(View, { style: [styles.g, styles.gLow], children: /* @__PURE__ */ jsxs(View, { style: [sheet, styles.gPhone], children: [
54
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 3, style: [styles.gPhoneTitle, {
55
+ color: palette.sheetInk
56
+ }], children: title }),
57
+ [0, 1, 2].map((row) => /* @__PURE__ */ jsx(View, { style: [styles.gRow, {
58
+ backgroundColor: palette.paper
59
+ }] }, row))
60
+ ] }) });
61
+ case "slides":
62
+ return /* @__PURE__ */ jsx(View, { style: styles.g, children: /* @__PURE__ */ jsxs(View, { style: [sheet, styles.gSlide], children: [
63
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [serif, styles.gSlideTitle], children: title }),
64
+ /* @__PURE__ */ jsx(View, { style: styles.gLine })
65
+ ] }) });
66
+ case "document":
67
+ return /* @__PURE__ */ jsx(View, { style: [styles.g, styles.gLow], children: /* @__PURE__ */ jsxs(View, { style: [sheet, styles.gPage], children: [
68
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 3, style: [serif, styles.gPageTitle], children: title }),
69
+ /* @__PURE__ */ jsx(View, { style: styles.gLine }),
70
+ /* @__PURE__ */ jsx(View, { style: styles.gLine })
71
+ ] }) });
72
+ case "image":
73
+ return /* @__PURE__ */ jsx(View, { style: styles.g, children: /* @__PURE__ */ jsx(View, { style: [sheet, styles.gPrint], children: /* @__PURE__ */ jsx(Text, { numberOfLines: 3, style: [serif, styles.gPrintTitle], children: title }) }) });
74
+ case "video":
75
+ return /* @__PURE__ */ jsxs(View, { style: [styles.g, styles.gVideo], children: [
76
+ /* @__PURE__ */ jsx(View, { style: styles.gPlay, children: /* @__PURE__ */ jsx(Ionicons, { name: "play", size: 20, color: "#ffffff", style: styles.gPlayIcon }) }),
77
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [serif, styles.gCap, {
78
+ color: "#ffffff"
79
+ }], children: title })
80
+ ] });
81
+ case "audio":
82
+ return /* @__PURE__ */ jsxs(View, { style: [styles.g, styles.gDark], children: [
83
+ /* @__PURE__ */ jsx(View, { style: styles.gWave, children: WAVE.map((bar) => /* @__PURE__ */ jsx(View, { style: [styles.gWaveBar, {
84
+ height: waveHeight(bar)
85
+ }] }, bar)) }),
86
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 2, style: [serif, styles.gDarkTitle, {
87
+ color: "#ffffff"
88
+ }], children: title })
89
+ ] });
90
+ case "character":
91
+ return /* @__PURE__ */ jsx(View, { style: styles.g, children: /* @__PURE__ */ jsx(View, { style: [styles.gMono, {
92
+ backgroundColor: palette.sheet
93
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.gMonoText, {
94
+ color: palette.sheetInk,
95
+ fontFamily: BUILD_SERIF
96
+ }], children: title.charAt(0) }) }) });
97
+ case "brand":
98
+ return /* @__PURE__ */ jsxs(View, { style: [styles.g, styles.gCol], children: [
99
+ /* @__PURE__ */ jsx(Text, { style: [styles.gAa, {
100
+ color: palette.brandInk,
101
+ fontFamily: BUILD_SERIF
102
+ }], children: "Aa" }),
103
+ /* @__PURE__ */ jsx(View, { style: styles.gDots, children: [palette.accent, "#1F2430", "#31B57E"].map((color) => /* @__PURE__ */ jsx(View, { style: [styles.gDot, {
104
+ backgroundColor: color,
105
+ borderColor: palette.sheet
106
+ }] }, color)) })
107
+ ] });
108
+ default:
109
+ return /* @__PURE__ */ jsx(View, { style: [styles.g, styles.gPlain], children: /* @__PURE__ */ jsx(Text, { numberOfLines: 3, style: [serif, {
110
+ color: palette.ink
111
+ }], children: title }) });
112
+ }
113
+ }
114
+ function TemplateTile({
115
+ card,
116
+ kind,
117
+ width,
118
+ used,
119
+ palette,
120
+ onUse
121
+ }) {
122
+ var _a;
123
+ const cover = (_a = card.coverImageUrl) == null ? void 0 : _a.trim();
124
+ const [coverLoaded, setCoverLoaded] = useState(false);
125
+ const [coverFailed, setCoverFailed] = useState(false);
126
+ const drawn = !cover || coverFailed || !coverLoaded;
127
+ const portrait = kind === "character";
128
+ const height = Math.round(portrait ? width * 1.25 : width * 0.75);
129
+ return /* @__PURE__ */ jsxs(View, { style: {
130
+ width
131
+ }, children: [
132
+ /* @__PURE__ */ jsxs(Pressable, { onPress: () => onUse(card), accessibilityRole: "button", accessibilityState: {
133
+ selected: used
134
+ }, accessibilityLabel: used ? `${card.title}, in your prompt` : `Use ${card.title}`, style: ({
135
+ pressed
136
+ }) => [styles.media, {
137
+ height,
138
+ backgroundColor: palette.paper
139
+ }, pressed && styles.pressed], children: [
140
+ drawn ? /* @__PURE__ */ jsx(DrawnCover, { kind, title: card.title, palette }) : null,
141
+ cover && !coverFailed ? /* @__PURE__ */ jsx(Image, { source: {
142
+ uri: cover
143
+ }, style: [styles.coverImage, {
144
+ opacity: coverLoaded ? 1 : 0
145
+ }], resizeMode: "cover", onLoad: () => setCoverLoaded(true), onError: () => setCoverFailed(true) }) : null,
146
+ portrait ? /* @__PURE__ */ jsxs(Fragment, { children: [
147
+ /* @__PURE__ */ jsx(Fade, { from: 0.55, opacity: 0.8, id: `plate-${card.id}` }),
148
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.plate, children: card.title })
149
+ ] }) : null,
150
+ used ? /* @__PURE__ */ jsxs(View, { style: styles.pin, children: [
151
+ /* @__PURE__ */ jsx(Feather, { name: "check", size: 13, color: "#1F8A5B" }),
152
+ /* @__PURE__ */ jsx(Text, { style: styles.pinText, children: "In your prompt" })
153
+ ] }) : (
154
+ // Always shown: a phone has no hover (buildViewStyles .yb-use, @media (hover:none)).
155
+ /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles.use, portrait ? styles.useTop : null, {
156
+ backgroundColor: palette.accent
157
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.useText, {
158
+ color: palette.onAccent
159
+ }], children: "Use" }) })
160
+ ),
161
+ /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles.mediaRing, used ? {
162
+ borderColor: palette.accent,
163
+ borderWidth: 2.5
164
+ } : {
165
+ borderColor: palette.border,
166
+ borderWidth: StyleSheet.hairlineWidth
167
+ }] })
168
+ ] }),
169
+ portrait ? null : /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles.tileTitle, {
170
+ color: palette.ink
171
+ }], children: card.title })
172
+ ] });
173
+ }
2
174
  function BuildTemplatesSection({
3
175
  enabled,
4
176
  group,
5
177
  orgName,
6
178
  isDark,
7
- primaryTextColor,
8
- secondaryTextColor,
179
+ palette,
180
+ kind,
9
181
  selectedTemplateId = null,
10
182
  onUseTemplate,
11
- compact = false
183
+ title = "Yantra templates",
184
+ tabs,
185
+ onDescribeOwn
12
186
  }) {
13
187
  const {
14
188
  width
@@ -16,7 +190,8 @@ function BuildTemplatesSection({
16
190
  const selectedGroup = (group != null ? group : "").trim();
17
191
  const [browseOpen, setBrowseOpen] = useState(false);
18
192
  const {
19
- cards
193
+ cards,
194
+ loading
20
195
  } = useMarketplaceTemplateCards({
21
196
  group: selectedGroup,
22
197
  orgName,
@@ -27,164 +202,428 @@ function BuildTemplatesSection({
27
202
  const rest = cards.filter((card) => card.id !== selectedTemplateId);
28
203
  return (selected ? [selected, ...rest] : rest).slice(0, FEATURED_COUNT);
29
204
  }, [cards, selectedTemplateId]);
30
- const cardWidth = useMemo(() => compact ? Math.min(128, Math.max(112, width * 0.3)) : Math.min(156, Math.max(136, width * 0.38)), [compact, width]);
31
- const coverHeight = compact ? Math.round(cardWidth * 0.5) : Math.round(cardWidth * 0.7);
32
- const borderColor = isDark ? "rgba(148,163,184,0.28)" : mobileTokens.color.border;
33
- const accent = isDark ? "#a5b4fc" : mobileTokens.color.primary;
34
- const surface = isDark ? "#1e293b" : "#f8fafc";
35
- const placeholderBg = isDark ? "#0f172a" : mobileTokens.color.primarySoft;
205
+ const [gridWidth, setGridWidth] = useState(0);
206
+ const tileWidth = Math.floor(((gridWidth || Math.min(width, 720) - 40) - GRID_GAP) / 2);
207
+ const ownHeight = Math.round(kind === "character" ? tileWidth * 1.25 : tileWidth * 0.75);
36
208
  const handleSelect = useCallback((card) => {
37
209
  onUseTemplate(card);
38
210
  setBrowseOpen(false);
39
211
  }, [onUseTemplate]);
40
- const renderCard = useCallback((item) => {
41
- var _a;
42
- const cover = (_a = item.coverImageUrl) == null ? void 0 : _a.trim();
43
- const selected = selectedTemplateId === item.id;
44
- return /* @__PURE__ */ jsxs(Pressable, { onPress: () => handleSelect(item), style: [styles.card, {
45
- width: cardWidth,
46
- backgroundColor: surface,
47
- borderColor: selected ? accent : borderColor,
48
- borderWidth: selected ? 2 : 1
49
- }], accessibilityRole: "button", accessibilityState: {
50
- selected
51
- }, accessibilityLabel: `${selected ? "Selected" : "Use"} template ${item.title}`, children: [
52
- /* @__PURE__ */ jsxs(View, { style: [styles.cover, {
53
- height: coverHeight,
54
- backgroundColor: placeholderBg
55
- }], children: [
56
- cover ? /* @__PURE__ */ jsx(Image, { source: {
57
- uri: cover
58
- }, style: styles.coverImage, resizeMode: "cover" }) : /* @__PURE__ */ jsx(Text, { style: [styles.coverFallback, {
59
- color: secondaryTextColor
60
- }], children: "Yantra" }),
61
- selected ? /* @__PURE__ */ jsx(View, { style: [styles.selectedMark, {
62
- backgroundColor: accent
63
- }], children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "check", size: 12, color: "#f8fafc" }) }) : null
64
- ] }),
65
- /* @__PURE__ */ jsx(View, { style: [styles.cardBody, compact ? styles.cardBodyCompact : null], children: /* @__PURE__ */ jsx(Text, { style: [styles.cardTitle, {
66
- color: primaryTextColor
67
- }], numberOfLines: 2, children: item.title }) })
68
- ] }, item.id);
69
- }, [accent, borderColor, cardWidth, compact, coverHeight, handleSelect, placeholderBg, primaryTextColor, secondaryTextColor, selectedTemplateId, surface]);
70
- if (!enabled || !selectedGroup || cards.length === 0) {
212
+ if (!enabled) {
71
213
  return null;
72
214
  }
73
- return /* @__PURE__ */ jsxs(View, { style: [styles.section, compact ? styles.sectionCompact : null], children: [
215
+ return /* @__PURE__ */ jsxs(View, { style: styles.section, children: [
74
216
  /* @__PURE__ */ jsxs(View, { style: styles.sectionHeader, children: [
75
- /* @__PURE__ */ jsx(Text, { style: [styles.sectionTitle, {
76
- color: secondaryTextColor
77
- }], children: "Yantra templates" }),
78
- /* @__PURE__ */ jsx(Pressable, { onPress: () => setBrowseOpen(true), hitSlop: 8, accessibilityRole: "button", accessibilityLabel: `Browse all ${cards.length} templates`, children: /* @__PURE__ */ jsx(Text, { style: [styles.seeAll, {
79
- color: accent
80
- }], children: cards.length > FEATURED_COUNT ? `See all ${cards.length}` : "Browse" }) })
217
+ /* @__PURE__ */ jsxs(View, { style: styles.titleRow, children: [
218
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles.sectionTitle, {
219
+ color: palette.ink
220
+ }], children: title }),
221
+ cards.length > 0 ? /* @__PURE__ */ jsx(View, { style: [styles.count, {
222
+ backgroundColor: palette.accentSoft
223
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.countText, {
224
+ color: palette.accent
225
+ }], children: cards.length }) }) : null
226
+ ] }),
227
+ cards.length > FEATURED_COUNT ? /* @__PURE__ */ jsxs(Pressable, { onPress: () => setBrowseOpen(true), hitSlop: 8, accessibilityRole: "button", accessibilityLabel: `See all ${cards.length} templates`, style: styles.seeAll, children: [
228
+ /* @__PURE__ */ jsx(Text, { style: [styles.seeAllText, {
229
+ color: palette.accent
230
+ }], children: "See all" }),
231
+ /* @__PURE__ */ jsx(Feather, { name: "chevron-right", size: 16, color: palette.accent })
232
+ ] }) : null
233
+ ] }),
234
+ /* @__PURE__ */ jsxs(Text, { style: [styles.guide, {
235
+ color: palette.muted
236
+ }], children: [
237
+ /* @__PURE__ */ jsx(Text, { style: [styles.guideStrong, {
238
+ color: palette.ink
239
+ }], children: "Use" }),
240
+ " puts it in the box below. Nothing runs until you press send."
81
241
  ] }),
82
- /* @__PURE__ */ jsxs(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.row, keyboardShouldPersistTaps: "handled", decelerationRate: "fast", children: [
83
- featured.map(renderCard),
84
- cards.length > FEATURED_COUNT ? /* @__PURE__ */ jsxs(Pressable, { onPress: () => setBrowseOpen(true), style: [styles.moreCard, {
85
- width: cardWidth,
86
- height: coverHeight + 40,
87
- borderColor,
88
- backgroundColor: surface
89
- }], accessibilityRole: "button", accessibilityLabel: `See all ${cards.length} templates`, children: [
90
- /* @__PURE__ */ jsxs(Text, { style: [styles.moreCount, {
91
- color: accent
92
- }], children: [
93
- "+",
94
- cards.length - FEATURED_COUNT
95
- ] }),
96
- /* @__PURE__ */ jsx(Text, { style: [styles.moreLabel, {
97
- color: secondaryTextColor
98
- }], children: "See all" })
242
+ tabs,
243
+ /* @__PURE__ */ jsxs(View, { style: styles.grid, onLayout: (event) => setGridWidth(event.nativeEvent.layout.width), children: [
244
+ featured.map((card) => /* @__PURE__ */ jsx(TemplateTile, { card, kind, width: tileWidth, used: card.id === selectedTemplateId, palette, onUse: handleSelect }, card.id)),
245
+ onDescribeOwn ? /* @__PURE__ */ jsxs(Pressable, { onPress: onDescribeOwn, accessibilityRole: "button", accessibilityLabel: "Describe your own", style: ({
246
+ pressed
247
+ }) => [styles.own, {
248
+ width: tileWidth,
249
+ minHeight: ownHeight,
250
+ borderColor: pressed ? palette.accent : palette.line2,
251
+ backgroundColor: pressed ? palette.accentSoft : "transparent"
252
+ }], children: [
253
+ /* @__PURE__ */ jsx(View, { style: [styles.ownIcon, {
254
+ backgroundColor: palette.card
255
+ }, BUILD_SHADOW], children: /* @__PURE__ */ jsx(Feather, { name: "edit-3", size: 18, color: palette.accent }) }),
256
+ /* @__PURE__ */ jsx(Text, { style: [styles.ownTitle, {
257
+ color: palette.ink
258
+ }], children: "Don\u2019t see it? Describe your own" }),
259
+ /* @__PURE__ */ jsx(Text, { style: [styles.ownBody, {
260
+ color: palette.muted
261
+ }], children: "Write it in the box below, and Yantra starts from scratch." })
99
262
  ] }) : null
100
263
  ] }),
264
+ loading && cards.length === 0 ? /* @__PURE__ */ jsx(ActivityIndicator, { style: styles.loading, color: palette.muted }) : null,
101
265
  /* @__PURE__ */ jsx(TemplateBrowserModal, { isOpen: browseOpen, onClose: () => setBrowseOpen(false), cards, selectedId: selectedTemplateId, onSelect: handleSelect, isDark })
102
266
  ] });
103
267
  }
104
268
  const styles = StyleSheet.create({
105
269
  section: {
106
270
  width: "100%",
107
- marginTop: 12,
108
- paddingBottom: 2
109
- },
110
- sectionCompact: {
111
- marginTop: 8
271
+ marginTop: 36,
272
+ paddingBottom: 12
112
273
  },
113
274
  sectionHeader: {
114
275
  flexDirection: "row",
115
- alignItems: "baseline",
276
+ alignItems: "center",
116
277
  justifyContent: "space-between",
117
- gap: 12,
118
- marginBottom: 8,
119
- paddingHorizontal: 2
278
+ gap: 12
279
+ },
280
+ titleRow: {
281
+ flexDirection: "row",
282
+ alignItems: "center",
283
+ gap: 8
120
284
  },
121
285
  sectionTitle: {
122
- fontSize: 11,
286
+ fontSize: 20,
123
287
  fontWeight: "600",
124
- letterSpacing: 0.6,
125
- textTransform: "uppercase"
288
+ letterSpacing: -0.4
289
+ },
290
+ count: {
291
+ minWidth: 22,
292
+ height: 22,
293
+ paddingHorizontal: 7,
294
+ borderRadius: 11,
295
+ alignItems: "center",
296
+ justifyContent: "center"
297
+ },
298
+ countText: {
299
+ fontSize: 12,
300
+ fontWeight: "600"
126
301
  },
127
302
  seeAll: {
128
- fontSize: 13,
303
+ flexDirection: "row",
304
+ alignItems: "center",
305
+ gap: 2
306
+ },
307
+ seeAllText: {
308
+ fontSize: 14,
129
309
  fontWeight: "600"
130
310
  },
131
- row: {
132
- gap: 10,
133
- paddingHorizontal: 2,
134
- paddingBottom: 4
311
+ guide: {
312
+ fontSize: 14,
313
+ lineHeight: 20,
314
+ marginTop: 4,
315
+ marginBottom: 16
135
316
  },
136
- card: {
137
- borderRadius: 10,
138
- overflow: "hidden"
317
+ guideStrong: {
318
+ fontWeight: "600"
139
319
  },
140
- cover: {
141
- alignItems: "center",
142
- justifyContent: "center"
320
+ grid: {
321
+ flexDirection: "row",
322
+ flexWrap: "wrap",
323
+ columnGap: GRID_GAP,
324
+ rowGap: 20
143
325
  },
144
- coverImage: {
145
- width: "100%",
146
- height: "100%"
326
+ pressed: {
327
+ opacity: 0.85
147
328
  },
148
- coverFallback: {
149
- fontSize: 12,
329
+ media: {
330
+ overflow: "hidden",
331
+ borderRadius: 14
332
+ },
333
+ mediaRing: __spreadProps(__spreadValues({}, StyleSheet.absoluteFillObject), {
334
+ borderRadius: 14
335
+ }),
336
+ coverImage: __spreadValues({}, StyleSheet.absoluteFillObject),
337
+ tileTitle: {
338
+ marginTop: 9,
339
+ marginHorizontal: 2,
340
+ fontSize: 14,
150
341
  fontWeight: "600",
151
- letterSpacing: 0.4
342
+ letterSpacing: -0.1
152
343
  },
153
- selectedMark: {
344
+ plate: {
345
+ position: "absolute",
346
+ left: 12,
347
+ right: 12,
348
+ bottom: 11,
349
+ color: "#ffffff",
350
+ fontSize: 14,
351
+ fontWeight: "600"
352
+ },
353
+ use: {
154
354
  position: "absolute",
155
- top: 8,
156
355
  right: 8,
157
- width: 20,
158
- height: 20,
159
- borderRadius: 10,
356
+ bottom: 8,
357
+ height: 30,
358
+ paddingHorizontal: 14,
359
+ borderRadius: 999,
160
360
  alignItems: "center",
161
- justifyContent: "center"
361
+ justifyContent: "center",
362
+ shadowColor: "#000",
363
+ shadowOpacity: 0.3,
364
+ shadowRadius: 8,
365
+ shadowOffset: {
366
+ width: 0,
367
+ height: 4
368
+ },
369
+ elevation: 3
162
370
  },
163
- cardBody: {
164
- paddingHorizontal: 9,
165
- paddingVertical: 8
371
+ useTop: {
372
+ top: 8,
373
+ bottom: void 0
374
+ },
375
+ useText: {
376
+ fontSize: 13,
377
+ fontWeight: "600"
166
378
  },
167
- cardBodyCompact: {
168
- paddingVertical: 6
379
+ pin: {
380
+ position: "absolute",
381
+ left: 8,
382
+ top: 8,
383
+ flexDirection: "row",
384
+ alignItems: "center",
385
+ gap: 4,
386
+ height: 26,
387
+ paddingLeft: 8,
388
+ paddingRight: 10,
389
+ borderRadius: 999,
390
+ backgroundColor: "#ffffff",
391
+ shadowColor: "#000",
392
+ shadowOpacity: 0.18,
393
+ shadowRadius: 6,
394
+ shadowOffset: {
395
+ width: 0,
396
+ height: 2
397
+ },
398
+ elevation: 2
169
399
  },
170
- cardTitle: {
400
+ pinText: {
171
401
  fontSize: 12,
172
402
  fontWeight: "600",
173
- lineHeight: 16
403
+ color: "#151B27"
174
404
  },
175
- moreCard: {
176
- borderRadius: 10,
177
- borderWidth: 1,
405
+ own: {
178
406
  alignItems: "center",
179
407
  justifyContent: "center",
180
- gap: 4
408
+ gap: 8,
409
+ padding: 14,
410
+ borderRadius: 14,
411
+ borderWidth: 1.5,
412
+ borderStyle: "dashed"
181
413
  },
182
- moreCount: {
183
- fontSize: 20,
414
+ ownIcon: {
415
+ width: 42,
416
+ height: 42,
417
+ borderRadius: 21,
418
+ alignItems: "center",
419
+ justifyContent: "center"
420
+ },
421
+ ownTitle: {
422
+ fontSize: 14,
423
+ fontWeight: "600",
424
+ textAlign: "center"
425
+ },
426
+ ownBody: {
427
+ fontSize: 12.5,
428
+ lineHeight: 17,
429
+ textAlign: "center"
430
+ },
431
+ loading: {
432
+ marginTop: 16
433
+ },
434
+ // Drawn covers (buildViewStyles .yb-g-*).
435
+ g: __spreadProps(__spreadValues({}, StyleSheet.absoluteFillObject), {
436
+ alignItems: "center",
437
+ justifyContent: "center",
438
+ overflow: "hidden"
439
+ }),
440
+ gLow: {
441
+ justifyContent: "flex-end"
442
+ },
443
+ sheet: {
444
+ gap: 7,
445
+ shadowColor: "#151B27",
446
+ shadowOpacity: 0.18,
447
+ shadowRadius: 12,
448
+ shadowOffset: {
449
+ width: 0,
450
+ height: 8
451
+ },
452
+ elevation: 3
453
+ },
454
+ gTitle: {
455
+ fontSize: 17,
456
+ lineHeight: 18
457
+ },
458
+ gInset: {
459
+ marginHorizontal: 12
460
+ },
461
+ gLine: {
462
+ width: "58%",
463
+ height: 5,
464
+ borderRadius: 3,
465
+ backgroundColor: "#ECE7DF"
466
+ },
467
+ gWin: {
468
+ width: "84%",
469
+ height: "84%",
470
+ overflow: "hidden",
471
+ borderTopLeftRadius: 10,
472
+ borderTopRightRadius: 10
473
+ },
474
+ gBar: {
475
+ flexDirection: "row",
476
+ alignItems: "center",
477
+ gap: 4,
478
+ height: 18,
479
+ paddingHorizontal: 9,
480
+ borderBottomWidth: 1,
481
+ borderBottomColor: "#EFEAE2"
482
+ },
483
+ gBarDot: {
484
+ width: 6,
485
+ height: 6,
486
+ borderRadius: 3,
487
+ backgroundColor: "#E2DCD2"
488
+ },
489
+ gPhone: {
490
+ width: "38%",
491
+ height: "86%",
492
+ paddingTop: 12,
493
+ paddingHorizontal: 7,
494
+ borderWidth: 3,
495
+ borderBottomWidth: 0,
496
+ borderColor: "#1B2230",
497
+ borderTopLeftRadius: 18,
498
+ borderTopRightRadius: 18
499
+ },
500
+ gPhoneTitle: {
501
+ fontSize: 11,
502
+ lineHeight: 13,
184
503
  fontWeight: "700"
185
504
  },
186
- moreLabel: {
187
- fontSize: 12,
188
- fontWeight: "600"
505
+ gRow: {
506
+ height: 16,
507
+ borderRadius: 6
508
+ },
509
+ gSlide: {
510
+ width: "76%",
511
+ aspectRatio: 16 / 9,
512
+ justifyContent: "space-between",
513
+ padding: "7%",
514
+ borderRadius: 8
515
+ },
516
+ gSlideTitle: {
517
+ fontSize: 15
518
+ },
519
+ gPage: {
520
+ width: "48%",
521
+ height: "86%",
522
+ paddingVertical: 12,
523
+ paddingHorizontal: 10,
524
+ borderTopLeftRadius: 6,
525
+ borderTopRightRadius: 6
526
+ },
527
+ gPageTitle: {
528
+ fontSize: 13,
529
+ lineHeight: 15
530
+ },
531
+ gPrint: {
532
+ width: "58%",
533
+ height: "76%",
534
+ justifyContent: "flex-end",
535
+ paddingTop: 8,
536
+ paddingHorizontal: 8,
537
+ paddingBottom: 14,
538
+ transform: [{
539
+ rotate: "-2deg"
540
+ }]
541
+ },
542
+ gPrintTitle: {
543
+ fontSize: 14,
544
+ lineHeight: 15
545
+ },
546
+ gVideo: {
547
+ backgroundColor: "#2A221C"
548
+ },
549
+ gPlay: {
550
+ width: 44,
551
+ height: 44,
552
+ borderRadius: 22,
553
+ borderWidth: 1,
554
+ borderColor: "rgba(255,255,255,0.4)",
555
+ backgroundColor: "rgba(255,255,255,0.16)",
556
+ alignItems: "center",
557
+ justifyContent: "center"
558
+ },
559
+ gPlayIcon: {
560
+ marginLeft: 3
561
+ },
562
+ gCap: {
563
+ position: "absolute",
564
+ left: 12,
565
+ right: 12,
566
+ bottom: 10,
567
+ fontSize: 15
568
+ },
569
+ gDark: {
570
+ gap: 12,
571
+ backgroundColor: "#1F2430"
572
+ },
573
+ gWave: {
574
+ flexDirection: "row",
575
+ alignItems: "center",
576
+ gap: 2,
577
+ width: "70%",
578
+ height: 36
579
+ },
580
+ gWaveBar: {
581
+ flex: 1,
582
+ borderRadius: 2,
583
+ backgroundColor: "#F3EFE8"
584
+ },
585
+ gDarkTitle: {
586
+ maxWidth: "86%",
587
+ fontSize: 14,
588
+ textAlign: "center"
589
+ },
590
+ gMono: {
591
+ width: "40%",
592
+ aspectRatio: 1,
593
+ borderRadius: 999,
594
+ alignItems: "center",
595
+ justifyContent: "center",
596
+ shadowColor: "#151B27",
597
+ shadowOpacity: 0.18,
598
+ shadowRadius: 12,
599
+ shadowOffset: {
600
+ width: 0,
601
+ height: 8
602
+ }
603
+ },
604
+ gMonoText: {
605
+ fontSize: 34
606
+ },
607
+ gCol: {
608
+ gap: 10
609
+ },
610
+ gAa: {
611
+ fontSize: 40,
612
+ lineHeight: 44
613
+ },
614
+ gDots: {
615
+ flexDirection: "row",
616
+ gap: 6
617
+ },
618
+ gDot: {
619
+ width: 16,
620
+ height: 16,
621
+ borderRadius: 8,
622
+ borderWidth: 2
623
+ },
624
+ gPlain: {
625
+ alignItems: "flex-start",
626
+ justifyContent: "flex-end",
627
+ padding: 14
189
628
  }
190
629
  });export{BuildTemplatesSection,BuildTemplatesSection as default};//# sourceMappingURL=BuildTemplatesSection.js.map