@vinaverse/react-native 0.1.0-alpha.8 → 0.1.0-alpha.9
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/README.md +10 -4
- package/dist/chat.cjs +63 -59
- package/dist/chat.d.cts +20 -6
- package/dist/chat.d.ts +20 -6
- package/dist/chat.js +1 -1
- package/dist/{chunk-NXGLI4Y7.js → chunk-GIQYOTNH.js} +89 -55
- package/dist/chunk-GIQYOTNH.js.map +1 -0
- package/dist/{chunk-EXN5TNLU.cjs → chunk-V7XYOLLT.cjs} +91 -53
- package/dist/chunk-V7XYOLLT.cjs.map +1 -0
- package/dist/index.cjs +63 -59
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/launcher.cjs +4 -0
- package/dist/launcher.d.cts +1 -1
- package/dist/launcher.d.ts +1 -1
- package/dist/launcher.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-EXN5TNLU.cjs.map +0 -1
- package/dist/chunk-NXGLI4Y7.js.map +0 -1
|
@@ -171,7 +171,7 @@ function safeImage(url) {
|
|
|
171
171
|
function InfoCard(props) {
|
|
172
172
|
const card = cardOf(props.card);
|
|
173
173
|
const { locale, t } = react$1.useCopy();
|
|
174
|
-
const { slots, timeZone } = useChat();
|
|
174
|
+
const { slots, timeZone, handlers } = useChat();
|
|
175
175
|
const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
|
|
176
176
|
const image = safeImage(card.image_url);
|
|
177
177
|
const Img = slots.Image ?? reactNative.Image;
|
|
@@ -180,13 +180,42 @@ function InfoCard(props) {
|
|
|
180
180
|
const amount = money ? react$1.formatMoney(money.amount, money.currency, locale) : null;
|
|
181
181
|
const price = amount && !card.price ? t("priceFrom", { price: amount }) : amount;
|
|
182
182
|
const when = card.starts_at ? react$1.formatTimeRange(card.starts_at, void 0, locale, timeZone) : null;
|
|
183
|
+
const status = typeof card.status === "string" && card.status ? card.status : null;
|
|
184
|
+
const ref = card.ref;
|
|
185
|
+
const onOpenTarget = handlers.current?.onOpenTarget;
|
|
186
|
+
const open = ref && onOpenTarget && !props.restored ? () => onOpenTarget({ type: ref.type, id: ref.id }, props.card) : null;
|
|
183
187
|
const label = [
|
|
184
188
|
card.title,
|
|
185
189
|
card.subtitle,
|
|
190
|
+
status,
|
|
186
191
|
rating && `\u2605 ${rating}`,
|
|
187
192
|
price,
|
|
188
193
|
when
|
|
189
194
|
].filter(Boolean).join(", ");
|
|
195
|
+
const top = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flexDirection: "row", gap: space.md }, children: [
|
|
196
|
+
image ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
Img,
|
|
198
|
+
{
|
|
199
|
+
source: { uri: image },
|
|
200
|
+
style: {
|
|
201
|
+
width: 64,
|
|
202
|
+
height: 64,
|
|
203
|
+
borderRadius: radius.md,
|
|
204
|
+
backgroundColor: colors.surface
|
|
205
|
+
},
|
|
206
|
+
accessible: false
|
|
207
|
+
}
|
|
208
|
+
) : null,
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1, gap: space.xxs }, children: [
|
|
210
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { numberOfLines: 2, children: card.title }),
|
|
211
|
+
card.subtitle ? /* @__PURE__ */ jsxRuntime.jsx(Body, { muted: true, children: card.subtitle }) : null,
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.textMuted, fontSize: font.size.sm }, children: [
|
|
213
|
+
rating && `\u2605 ${rating}${card.rating ? ` (${card.rating.count})` : ""}`,
|
|
214
|
+
price,
|
|
215
|
+
when
|
|
216
|
+
].filter(Boolean).join(" \xB7 ") })
|
|
217
|
+
] })
|
|
218
|
+
] });
|
|
190
219
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
191
220
|
CardFrame,
|
|
192
221
|
{
|
|
@@ -194,32 +223,23 @@ function InfoCard(props) {
|
|
|
194
223
|
restored: props.restored,
|
|
195
224
|
testID: `vinaverse-card-${card.id}`,
|
|
196
225
|
children: [
|
|
197
|
-
/* @__PURE__ */ jsxRuntime.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
accessible: false
|
|
209
|
-
}
|
|
210
|
-
) : null,
|
|
211
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1, gap: space.xxs }, children: [
|
|
212
|
-
/* @__PURE__ */ jsxRuntime.jsx(Title, { numberOfLines: 2, children: card.title }),
|
|
213
|
-
card.subtitle ? /* @__PURE__ */ jsxRuntime.jsx(Body, { muted: true, children: card.subtitle }) : null,
|
|
214
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.textMuted, fontSize: font.size.sm }, children: [
|
|
215
|
-
rating && `\u2605 ${rating}${card.rating ? ` (${card.rating.count})` : ""}`,
|
|
216
|
-
price,
|
|
217
|
-
when
|
|
218
|
-
].filter(Boolean).join(" \xB7 ") })
|
|
219
|
-
] })
|
|
220
|
-
] }),
|
|
226
|
+
open ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
227
|
+
reactNative.Pressable,
|
|
228
|
+
{
|
|
229
|
+
accessibilityRole: "link",
|
|
230
|
+
accessibilityLabel: card.title,
|
|
231
|
+
onPress: open,
|
|
232
|
+
testID: `vinaverse-open-${card.id}`,
|
|
233
|
+
children: top
|
|
234
|
+
}
|
|
235
|
+
) : top,
|
|
221
236
|
card.body ? /* @__PURE__ */ jsxRuntime.jsx(Body, { children: card.body }) : null,
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
238
|
+
Badges,
|
|
239
|
+
{
|
|
240
|
+
badges: status ? [status, ...card.badges ?? []] : card.badges
|
|
241
|
+
}
|
|
242
|
+
),
|
|
223
243
|
props.restored ? null : /* @__PURE__ */ jsxRuntime.jsx(CardActions, { ...props })
|
|
224
244
|
]
|
|
225
245
|
}
|
|
@@ -330,14 +350,24 @@ function ListingCard(props) {
|
|
|
330
350
|
)
|
|
331
351
|
}) : null;
|
|
332
352
|
const next = card.next_available ? t("nextAvailable", {
|
|
333
|
-
|
|
353
|
+
// "today, 10:00 AM", "tomorrow, 10:00 AM", else the date (the copy's `today` and `tomorrow`).
|
|
354
|
+
time: react$1.formatDayTime(
|
|
355
|
+
card.next_available,
|
|
356
|
+
{ today: t("today"), tomorrow: t("tomorrow") },
|
|
357
|
+
locale,
|
|
358
|
+
timeZone
|
|
359
|
+
)
|
|
334
360
|
}) : null;
|
|
335
361
|
const ref = card.ref;
|
|
336
362
|
const onOpenTarget = handlers.current?.onOpenTarget;
|
|
337
363
|
const open = ref && onOpenTarget && !props.restored ? () => onOpenTarget({ type: ref.type, id: ref.id }, props.card) : null;
|
|
364
|
+
const asked = imagePolicy?.aspectRatio;
|
|
365
|
+
const size2 = card.images?.[0];
|
|
366
|
+
const range = imagePolicy?.naturalAspect ?? { min: 1, max: 2 };
|
|
367
|
+
const own = asked === "natural" && !props.grouped && size2?.width && size2.height ? Math.min(range.max, Math.max(range.min, size2.width / size2.height)) : null;
|
|
338
368
|
const photo = {
|
|
339
369
|
width: "100%",
|
|
340
|
-
aspectRatio:
|
|
370
|
+
aspectRatio: own ?? (typeof asked === "number" ? asked : 1.6),
|
|
341
371
|
borderRadius: radius.md
|
|
342
372
|
};
|
|
343
373
|
const top = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1296,7 +1326,13 @@ var CardView = /* @__PURE__ */ react.memo(function CardView2(props) {
|
|
|
1296
1326
|
const Default = defaultCard(card.kind);
|
|
1297
1327
|
const Custom = slots.cards?.[card.kind];
|
|
1298
1328
|
const read = react.useMemo(() => agent$1.readCard(card.card), [card]);
|
|
1299
|
-
const own = {
|
|
1329
|
+
const own = {
|
|
1330
|
+
card,
|
|
1331
|
+
read,
|
|
1332
|
+
busy,
|
|
1333
|
+
restored: props.item.restored === true,
|
|
1334
|
+
grouped: props.grouped === true
|
|
1335
|
+
};
|
|
1300
1336
|
return Custom ? /* @__PURE__ */ jsxRuntime.jsx(Custom, { ...own, Default }) : /* @__PURE__ */ jsxRuntime.jsx(Default, { ...own });
|
|
1301
1337
|
});
|
|
1302
1338
|
var keyOf = (item) => item.key;
|
|
@@ -1319,7 +1355,7 @@ function CardCarousel(props) {
|
|
|
1319
1355
|
data: props.items,
|
|
1320
1356
|
keyExtractor: keyOf,
|
|
1321
1357
|
getItemType: kindOf,
|
|
1322
|
-
renderItem: ({ item }) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { width: size2 }, children: /* @__PURE__ */ jsxRuntime.jsx(CardView, { item }) }),
|
|
1358
|
+
renderItem: ({ item }) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { width: size2 }, children: /* @__PURE__ */ jsxRuntime.jsx(CardView, { item, grouped: true }) }),
|
|
1323
1359
|
snapToInterval: size2,
|
|
1324
1360
|
decelerationRate: "fast",
|
|
1325
1361
|
showsHorizontalScrollIndicator: false
|
|
@@ -1905,29 +1941,27 @@ function authorOf(item) {
|
|
|
1905
1941
|
return item?.type === "message" ? item.role : null;
|
|
1906
1942
|
}
|
|
1907
1943
|
function carousels(items, previous) {
|
|
1944
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1945
|
+
for (const item of items) {
|
|
1946
|
+
if (item.type !== "card") continue;
|
|
1947
|
+
const group = item.card.card.group;
|
|
1948
|
+
if (group?.layout !== "carousel" || typeof group.id !== "string") continue;
|
|
1949
|
+
const id = `${item.card.turnId ?? ""}\0${group.id}`;
|
|
1950
|
+
const members = groups.get(id);
|
|
1951
|
+
if (members) members.push(item);
|
|
1952
|
+
else groups.set(id, [item]);
|
|
1953
|
+
}
|
|
1908
1954
|
const runs = /* @__PURE__ */ new Map();
|
|
1909
1955
|
const inside = /* @__PURE__ */ new Set();
|
|
1910
|
-
const
|
|
1911
|
-
if (
|
|
1912
|
-
const
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
while (end < items.length && groupOf(items[end]) === id) end++;
|
|
1920
|
-
if (end - i > 1) {
|
|
1921
|
-
const run = items.slice(i, end);
|
|
1922
|
-
const key = run[0]?.key;
|
|
1923
|
-
const before = previous.get(key);
|
|
1924
|
-
runs.set(
|
|
1925
|
-
key,
|
|
1926
|
-
before && before.length === run.length && before.every((c, n) => c === run[n]) ? before : run
|
|
1927
|
-
);
|
|
1928
|
-
for (const card of run.slice(1)) inside.add(card.key);
|
|
1929
|
-
}
|
|
1930
|
-
i = end - 1;
|
|
1956
|
+
for (const run of groups.values()) {
|
|
1957
|
+
if (run.length < 2) continue;
|
|
1958
|
+
const key = run[0]?.key;
|
|
1959
|
+
const before = previous.get(key);
|
|
1960
|
+
runs.set(
|
|
1961
|
+
key,
|
|
1962
|
+
before && before.length === run.length && before.every((c, n) => c === run[n]) ? before : run
|
|
1963
|
+
);
|
|
1964
|
+
for (const card of run.slice(1)) inside.add(card.key);
|
|
1931
1965
|
}
|
|
1932
1966
|
return { runs, inside };
|
|
1933
1967
|
}
|
|
@@ -2604,6 +2638,10 @@ Object.defineProperty(exports, "useAgentStatus", {
|
|
|
2604
2638
|
enumerable: true,
|
|
2605
2639
|
get: function () { return agent.useAgentStatus; }
|
|
2606
2640
|
});
|
|
2641
|
+
Object.defineProperty(exports, "useAgentStatusState", {
|
|
2642
|
+
enumerable: true,
|
|
2643
|
+
get: function () { return agent.useAgentStatusState; }
|
|
2644
|
+
});
|
|
2607
2645
|
exports.ActivityLine = ActivityLine;
|
|
2608
2646
|
exports.AgentChat = AgentChat;
|
|
2609
2647
|
exports.AgentFooter = AgentFooter;
|
|
@@ -2652,5 +2690,5 @@ exports.monogram = monogram;
|
|
|
2652
2690
|
exports.newestWholeReply = newestWholeReply;
|
|
2653
2691
|
exports.ratingText = ratingText;
|
|
2654
2692
|
exports.useChat = useChat;
|
|
2655
|
-
//# sourceMappingURL=chunk-
|
|
2656
|
-
//# sourceMappingURL=chunk-
|
|
2693
|
+
//# sourceMappingURL=chunk-V7XYOLLT.cjs.map
|
|
2694
|
+
//# sourceMappingURL=chunk-V7XYOLLT.cjs.map
|