@rocapine/react-native-onboarding 1.52.0 → 1.54.0
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 +1 -1
- package/dist/OnboardingStudioClient.d.ts +8 -0
- package/dist/OnboardingStudioClient.d.ts.map +1 -1
- package/dist/OnboardingStudioClient.js +15 -0
- package/dist/OnboardingStudioClient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/queries/cacheKey.d.ts +20 -0
- package/dist/infra/queries/cacheKey.d.ts.map +1 -0
- package/dist/infra/queries/cacheKey.js +26 -0
- package/dist/infra/queries/cacheKey.js.map +1 -0
- package/dist/infra/queries/getOnboarding.query.d.ts.map +1 -1
- package/dist/infra/queries/getOnboarding.query.js +20 -10
- package/dist/infra/queries/getOnboarding.query.js.map +1 -1
- package/dist/onboarding-example.d.ts +185 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +27 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts +120 -0
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.js +15 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/OnboardingStudioClient.ts +13 -0
- package/src/__tests__/getOnboarding.query.test.ts +76 -5
- package/src/index.ts +5 -0
- package/src/infra/queries/cacheKey.ts +24 -0
- package/src/infra/queries/getOnboarding.query.ts +20 -11
- package/src/onboarding-example.ts +27 -0
- package/src/steps/ComposableScreen/elements/DatePickerElement.ts +35 -0
- package/src/types.ts +10 -0
|
@@ -6,6 +6,39 @@ import { BaseBoxProps, BaseBoxPropsSchema } from "./BaseBoxProps";
|
|
|
6
6
|
// would go stale (e.g. a max date that should always be today).
|
|
7
7
|
const isDateStringOrNow = (s: string) => s === "now" || !isNaN(Date.parse(s));
|
|
8
8
|
|
|
9
|
+
// Subset of Intl.DateTimeFormatOptions used to format the displayed/stored
|
|
10
|
+
// label (Android trigger text + variable `label`). Forwarded as-is to the
|
|
11
|
+
// toLocale*String call matching the picker `mode`. NOTE: Intl throws if
|
|
12
|
+
// `dateStyle`/`timeStyle` is combined with component fields (hour/day/etc.) —
|
|
13
|
+
// authors must not mix the two; the schema does not enforce it.
|
|
14
|
+
export type DateTimeFormatOptions = {
|
|
15
|
+
weekday?: "long" | "short" | "narrow";
|
|
16
|
+
year?: "numeric" | "2-digit";
|
|
17
|
+
month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
|
|
18
|
+
day?: "numeric" | "2-digit";
|
|
19
|
+
hour?: "numeric" | "2-digit";
|
|
20
|
+
minute?: "numeric" | "2-digit";
|
|
21
|
+
second?: "numeric" | "2-digit";
|
|
22
|
+
hour12?: boolean;
|
|
23
|
+
hourCycle?: "h11" | "h12" | "h23" | "h24";
|
|
24
|
+
dateStyle?: "full" | "long" | "medium" | "short";
|
|
25
|
+
timeStyle?: "full" | "long" | "medium" | "short";
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const DateTimeFormatOptionsSchema = z.object({
|
|
29
|
+
weekday: z.enum(["long", "short", "narrow"]).optional(),
|
|
30
|
+
year: z.enum(["numeric", "2-digit"]).optional(),
|
|
31
|
+
month: z.enum(["numeric", "2-digit", "long", "short", "narrow"]).optional(),
|
|
32
|
+
day: z.enum(["numeric", "2-digit"]).optional(),
|
|
33
|
+
hour: z.enum(["numeric", "2-digit"]).optional(),
|
|
34
|
+
minute: z.enum(["numeric", "2-digit"]).optional(),
|
|
35
|
+
second: z.enum(["numeric", "2-digit"]).optional(),
|
|
36
|
+
hour12: z.boolean().optional(),
|
|
37
|
+
hourCycle: z.enum(["h11", "h12", "h23", "h24"]).optional(),
|
|
38
|
+
dateStyle: z.enum(["full", "long", "medium", "short"]).optional(),
|
|
39
|
+
timeStyle: z.enum(["full", "long", "medium", "short"]).optional(),
|
|
40
|
+
});
|
|
41
|
+
|
|
9
42
|
export type DatePickerElementProps = BaseBoxProps & {
|
|
10
43
|
variableName?: string;
|
|
11
44
|
defaultValue?: string;
|
|
@@ -16,6 +49,7 @@ export type DatePickerElementProps = BaseBoxProps & {
|
|
|
16
49
|
textColor?: string;
|
|
17
50
|
accentColor?: string;
|
|
18
51
|
locale?: string;
|
|
52
|
+
format?: DateTimeFormatOptions;
|
|
19
53
|
};
|
|
20
54
|
|
|
21
55
|
export const DatePickerElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
@@ -28,4 +62,5 @@ export const DatePickerElementPropsSchema = BaseBoxPropsSchema.extend({
|
|
|
28
62
|
textColor: z.string().optional(),
|
|
29
63
|
accentColor: z.string().optional(),
|
|
30
64
|
locale: z.string().optional(),
|
|
65
|
+
format: DateTimeFormatOptionsSchema.optional(),
|
|
31
66
|
});
|
package/src/types.ts
CHANGED
|
@@ -24,6 +24,16 @@ export type OnboardingStudioClientOptions<
|
|
|
24
24
|
baseUrl?: string;
|
|
25
25
|
fallbackOnboarding?: Onboarding<StepType>;
|
|
26
26
|
timeout?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional custom cache key. When provided, the fetched onboarding is
|
|
29
|
+
* persisted under `"rocapine-onboarding-sdk-{cacheKey}"` and served
|
|
30
|
+
* **cache-first with no background revalidation** — the pinned version stays
|
|
31
|
+
* put across launches until the host refetches (see
|
|
32
|
+
* `OnboardingStudioClient.clearCache`). Omit for the default key
|
|
33
|
+
* (`"rocapine-onboarding-studio"`) with stale-while-revalidate caching.
|
|
34
|
+
* Ignored in sandbox mode (which always fetches fresh).
|
|
35
|
+
*/
|
|
36
|
+
cacheKey?: string;
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
export type OnboardingOptions = {
|