@namiml/expo-sdk 3.4.4-dev.202607012039 → 3.4.4-dev.202607022250
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/dist/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/utils/rendering.ts +44 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namiml/expo-sdk",
|
|
3
|
-
"version": "3.4.4-dev.
|
|
3
|
+
"version": "3.4.4-dev.202607022250",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Nami Expo SDK — paywall and subscription management for Expo apps",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"prepublishOnly": "yarn clean && yarn build:prod"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@namiml/expo-nami-iap": "3.4.4-dev.
|
|
33
|
-
"@namiml/sdk-core": "3.4.4-dev.
|
|
32
|
+
"@namiml/expo-nami-iap": "3.4.4-dev.202607022250",
|
|
33
|
+
"@namiml/sdk-core": "3.4.4-dev.202607022250",
|
|
34
34
|
"react-native-qrcode-svg": "^6.3.21",
|
|
35
35
|
"react-native-safe-area-context": "^5.6.0",
|
|
36
36
|
"react-native-svg": "^15.15.4"
|
package/src/utils/rendering.ts
CHANGED
|
@@ -137,10 +137,22 @@ export function getRepeatingListBlocks(ctx: any, component: any): TComponent[][]
|
|
|
137
137
|
const groupBy: string | undefined = component.groupBy;
|
|
138
138
|
const headerTemplate: TComponent | undefined = component.groupHeaderTemplate;
|
|
139
139
|
|
|
140
|
+
// Slots injected after the data pipeline (filter → group → cap). A slot is visible when its
|
|
141
|
+
// (non-block) conditions all pass; it renders as a plain item block (no __namiGroupHeader
|
|
142
|
+
// marker → no timeline dot). Unknown positions/ordinals are skipped (tolerant).
|
|
143
|
+
const visibleSlots: any[] = (component.slots ?? []).filter(
|
|
144
|
+
(slot: any) =>
|
|
145
|
+
!slot.conditions?.length ||
|
|
146
|
+
slot.conditions.every((condition: any) => testObjectMatches(ctx, condition, undefined)),
|
|
147
|
+
);
|
|
148
|
+
const slotBlock = (slot: any): TComponent[] => [slot.template as TComponent];
|
|
149
|
+
const listStart = visibleSlots.filter((s) => s.position === 'listStart').map(slotBlock);
|
|
150
|
+
const listEnd = visibleSlots.filter((s) => s.position === 'listEnd').map(slotBlock);
|
|
151
|
+
|
|
140
152
|
if (!groupBy || !headerTemplate) {
|
|
141
153
|
const cappedBlocks =
|
|
142
154
|
component.max != null ? filteredBlocks.slice(0, component.max) : filteredBlocks;
|
|
143
|
-
return cappedBlocks.map(renderItem);
|
|
155
|
+
return [...listStart, ...cappedBlocks.map(renderItem), ...listEnd];
|
|
144
156
|
}
|
|
145
157
|
|
|
146
158
|
const sectionOrder: string[] = [];
|
|
@@ -155,12 +167,40 @@ export function getRepeatingListBlocks(ctx: any, component: any): TComponent[][]
|
|
|
155
167
|
sections.get(key)!.push(block);
|
|
156
168
|
}
|
|
157
169
|
|
|
158
|
-
|
|
170
|
+
// Resolve groupStart/groupEnd target keys using the pre-cap filtered blocks: a group qualifies
|
|
171
|
+
// if any item passes all itemConditions (block context); ordinal picks first/last qualifier.
|
|
172
|
+
const groupQualifies = (slot: any, blocks: any[]): boolean => {
|
|
173
|
+
const conditions = slot.group?.itemConditions ?? [];
|
|
174
|
+
if (!conditions.length) return blocks.length > 0;
|
|
175
|
+
return blocks.some((block) => conditions.every((c: any) => testObjectMatches(ctx, c, block)));
|
|
176
|
+
};
|
|
177
|
+
const targetGroupKey = (slot: any): string | undefined => {
|
|
178
|
+
const qualifying = sectionOrder.filter((key) => groupQualifies(slot, sections.get(key)!));
|
|
179
|
+
return slot.group?.ordinal === 'last' ? qualifying[qualifying.length - 1] : qualifying[0];
|
|
180
|
+
};
|
|
181
|
+
const groupStartByKey = new Map<string, TComponent[][]>();
|
|
182
|
+
const groupEndByKey = new Map<string, TComponent[][]>();
|
|
183
|
+
for (const slot of visibleSlots) {
|
|
184
|
+
const byKey =
|
|
185
|
+
slot.position === 'groupStart'
|
|
186
|
+
? groupStartByKey
|
|
187
|
+
: slot.position === 'groupEnd'
|
|
188
|
+
? groupEndByKey
|
|
189
|
+
: null;
|
|
190
|
+
if (!byKey) continue;
|
|
191
|
+
const key = targetGroupKey(slot);
|
|
192
|
+
if (key == null) continue;
|
|
193
|
+
if (!byKey.has(key)) byKey.set(key, []);
|
|
194
|
+
byKey.get(key)!.push(slotBlock(slot));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const result: TComponent[][] = [...listStart];
|
|
159
198
|
for (const key of sectionOrder) {
|
|
160
199
|
const group = { key };
|
|
161
200
|
const header = interpolate(headerTemplate, interpolate({ group }, { group })) as any;
|
|
162
201
|
header.__namiGroupHeader = true;
|
|
163
202
|
result.push([header]);
|
|
203
|
+
result.push(...(groupStartByKey.get(key) ?? []));
|
|
164
204
|
const groupItems =
|
|
165
205
|
component.groupMax != null
|
|
166
206
|
? sections.get(key)!.slice(0, component.groupMax)
|
|
@@ -168,7 +208,9 @@ export function getRepeatingListBlocks(ctx: any, component: any): TComponent[][]
|
|
|
168
208
|
for (const block of groupItems) {
|
|
169
209
|
result.push(renderItem(block));
|
|
170
210
|
}
|
|
211
|
+
result.push(...(groupEndByKey.get(key) ?? []));
|
|
171
212
|
}
|
|
213
|
+
result.push(...listEnd);
|
|
172
214
|
return result;
|
|
173
215
|
}
|
|
174
216
|
|