Skip to content

Commit 6d8cd77

Browse files
committed
Provide a UI where the API for the MINI can be tried out
1 parent fd2637c commit 6d8cd77

File tree

1 file changed

+61
-13
lines changed

1 file changed

+61
-13
lines changed

src/App.tsx

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,70 @@ function App({ appUrl, filter }: Props) {
291291
return await liff.permanentLink.createUrlBy(url)
292292
}}
293293
/>
294-
<Snippet
295-
apiName="liff.i18n.setLang"
296-
version="2.21.0"
297-
docUrl="https://developers.line.biz/ja/reference/liff/#i18n-set-lang"
298-
needRequestPayload={true}
299-
skipAutoRun={true}
300-
hideResponse={true}
301-
defaultRequestPayload={'en'}
302-
runner={async (lang) => {
303-
return await liff.i18n.setLang(lang)
304-
}}
305-
/>
294+
{(filter === FilterTypes.MINI ||
295+
filter === FilterTypes.MINI_PREVIEW) && (
296+
<>
297+
<Snippet
298+
apiName="liff.createShortcutOnHomeScreen"
299+
version="2.23.0"
300+
docUrl="https://developers.line.biz/en/reference/liff/#create-shortcut-on-home-screen"
301+
needRequestPayload={true}
302+
defaultRequestPayload={JSON.stringify(
303+
{
304+
url: appUrl,
305+
},
306+
null,
307+
4
308+
)}
309+
runner={async (payload) => {
310+
const parsed = JSON.parse(payload)
311+
await liff.createShortcutOnHomeScreen(parsed);
312+
}}
313+
skipAutoRun={true}
314+
isInLIFF={false}
315+
/>
316+
<Snippet
317+
apiName="liff.$commonProfile.getDummy"
318+
version="2.19.0"
319+
docUrl="https://developers.line.biz/en/docs/partner-docs/quick-fill/overview/"
320+
needRequestPayload={true}
321+
defaultRequestPayload={JSON.stringify(
322+
[
323+
[
324+
'family-name',
325+
'given-name',
326+
'family-name-kana',
327+
'given-name-kana',
328+
'sex-enum',
329+
'bday-year',
330+
'bday-month',
331+
'bday-day',
332+
'tel',
333+
'email',
334+
'postal-code',
335+
'address-level1',
336+
'address-level2',
337+
'address-level3',
338+
'address-level4',
339+
],
340+
1,
341+
],
342+
null,
343+
4
344+
)}
345+
runner={async (p) => {
346+
const payload = JSON.parse(p)
347+
return await liff.$commonProfile.getDummy(...payload)
348+
}}
349+
inClientOnly={true}
350+
skipAutoRun={true}
351+
isInLIFF={false}
352+
/>
353+
</>
354+
)}
306355
</div>
307356
</FilterContext.Provider>
308357
)
309358
}
310359

311-
312360
export default App

0 commit comments

Comments
 (0)