@rocapine/react-native-onboarding 1.15.0 → 1.17.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/fonts/FontRegistryContext.d.ts +16 -0
- package/dist/infra/fonts/FontRegistryContext.d.ts.map +1 -0
- package/dist/infra/fonts/FontRegistryContext.js +35 -0
- package/dist/infra/fonts/FontRegistryContext.js.map +1 -0
- package/dist/infra/fonts/index.d.ts +3 -0
- package/dist/infra/fonts/index.d.ts.map +1 -0
- package/dist/infra/fonts/index.js +13 -0
- package/dist/infra/fonts/index.js.map +1 -0
- package/dist/infra/fonts/registry.d.ts +6 -0
- package/dist/infra/fonts/registry.d.ts.map +1 -0
- package/dist/infra/fonts/registry.js +96 -0
- package/dist/infra/fonts/registry.js.map +1 -0
- package/dist/infra/index.d.ts +1 -0
- package/dist/infra/index.d.ts.map +1 -1
- package/dist/infra/index.js +1 -0
- package/dist/infra/index.js.map +1 -1
- package/dist/infra/provider/FontLoader.d.ts +9 -0
- package/dist/infra/provider/FontLoader.d.ts.map +1 -0
- package/dist/infra/provider/FontLoader.js +38 -0
- package/dist/infra/provider/FontLoader.js.map +1 -0
- package/dist/infra/provider/OnboardingProvider.d.ts +20 -1
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +13 -3
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/infra/provider/index.d.ts +2 -0
- package/dist/infra/provider/index.d.ts.map +1 -1
- package/dist/infra/provider/index.js +3 -1
- package/dist/infra/provider/index.js.map +1 -1
- package/dist/onboarding-example.d.ts +100 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +27 -1
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +35 -0
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js +12 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts +5 -0
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts +5 -0
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/InputElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/InputElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +5 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts +5 -0
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/TextElement.js +1 -0
- package/dist/steps/ComposableScreen/elements/TextElement.js.map +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +10 -1
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +4 -1
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/index.ts +10 -0
- package/src/infra/fonts/FontRegistryContext.tsx +45 -0
- package/src/infra/fonts/index.ts +12 -0
- package/src/infra/fonts/registry.ts +104 -0
- package/src/infra/index.ts +1 -0
- package/src/infra/provider/FontLoader.tsx +40 -0
- package/src/infra/provider/OnboardingProvider.tsx +68 -6
- package/src/infra/provider/index.ts +5 -0
- package/src/onboarding-example.ts +27 -1
- package/src/steps/ComposableScreen/elements/ButtonElement.ts +31 -0
- package/src/steps/ComposableScreen/elements/CheckboxGroupElement.ts +2 -0
- package/src/steps/ComposableScreen/elements/InputElement.ts +2 -0
- package/src/steps/ComposableScreen/elements/RadioGroupElement.ts +2 -0
- package/src/steps/ComposableScreen/elements/TextElement.ts +2 -0
- package/src/steps/ComposableScreen/types.ts +8 -1
- package/src/types.ts +21 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { OnboardingStudioClient } from "./OnboardingStudioClient";
|
|
2
2
|
export * from "./types";
|
|
3
3
|
export * from "./onboarding-example";
|
|
4
|
+
export type { ButtonAction, CustomButtonAction, ComposableVariableEntry, } from "./steps/ComposableScreen/types";
|
|
5
|
+
export { ButtonActionSchema, CustomButtonActionSchema, } from "./steps/ComposableScreen/types";
|
|
4
6
|
export * from "./infra";
|
|
5
7
|
export { resolveNextStepNumber } from "./resolveNextStepNumber";
|
|
6
8
|
export type { LeafCondition, ConditionGroup, ConditionValue, ConditionOperator, Branch, NextStep, } from "./steps/common.types";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AAErC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AAErC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ConditionValueSchema = exports.ConditionOperatorSchema = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.BaseStepTypeSchema = exports.resolveNextStepNumber = exports.OnboardingStudioClient = void 0;
|
|
17
|
+
exports.ConditionValueSchema = exports.ConditionOperatorSchema = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.BaseStepTypeSchema = exports.resolveNextStepNumber = exports.CustomButtonActionSchema = exports.ButtonActionSchema = exports.OnboardingStudioClient = void 0;
|
|
18
18
|
// Core client and types
|
|
19
19
|
var OnboardingStudioClient_1 = require("./OnboardingStudioClient");
|
|
20
20
|
Object.defineProperty(exports, "OnboardingStudioClient", { enumerable: true, get: function () { return OnboardingStudioClient_1.OnboardingStudioClient; } });
|
|
21
21
|
__exportStar(require("./types"), exports);
|
|
22
22
|
__exportStar(require("./onboarding-example"), exports);
|
|
23
|
+
var types_1 = require("./steps/ComposableScreen/types");
|
|
24
|
+
Object.defineProperty(exports, "ButtonActionSchema", { enumerable: true, get: function () { return types_1.ButtonActionSchema; } });
|
|
25
|
+
Object.defineProperty(exports, "CustomButtonActionSchema", { enumerable: true, get: function () { return types_1.CustomButtonActionSchema; } });
|
|
23
26
|
// Hooks and providers
|
|
24
27
|
__exportStar(require("./infra"), exports);
|
|
25
28
|
// Branching
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wBAAwB;AACxB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,0CAAwB;AACxB,uDAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wBAAwB;AACxB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,0CAAwB;AACxB,uDAAqC;AAOrC,wDAGwC;AAFtC,2GAAA,kBAAkB,OAAA;AAClB,iHAAA,wBAAwB,OAAA;AAE1B,sBAAsB;AACtB,0CAAwB;AACxB,YAAY;AACZ,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAS9B,qDAQ8B;AAP5B,kHAAA,kBAAkB,OAAA;AAClB,mHAAA,mBAAmB,OAAA;AACnB,oHAAA,oBAAoB,OAAA;AACpB,4GAAA,YAAY,OAAA;AACZ,8GAAA,cAAc,OAAA;AACd,uHAAA,uBAAuB,OAAA;AACvB,oHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FontRegistry } from "./registry";
|
|
2
|
+
export declare const FontRegistryProvider: import("react").Provider<FontRegistry>;
|
|
3
|
+
export declare const useFontRegistry: () => FontRegistry;
|
|
4
|
+
export declare const useResolvedFontFamily: (family: string | null | undefined, weight: string | number | null | undefined) => string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a `family + weight` request to a registered font name. Returns
|
|
7
|
+
* `resolvedToVariant: true` when the registry matched a concrete weighted
|
|
8
|
+
* variant — callers should then suppress `fontWeight` on the rendered Text to
|
|
9
|
+
* avoid synthetic emboldening on top of an already-weighted font file.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useResolvedFontStyle: (family: string | null | undefined, weight: string | number | null | undefined) => {
|
|
12
|
+
fontFamily: string | undefined;
|
|
13
|
+
fontWeight: string | number | undefined;
|
|
14
|
+
resolvedToVariant: boolean;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=FontRegistryContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontRegistryContext.d.ts","sourceRoot":"","sources":["../../../src/infra/fonts/FontRegistryContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,eAAO,MAAM,oBAAoB,wCAA+B,CAAC;AAEjE,eAAO,MAAM,eAAe,QAAO,YAA+C,CAAC;AAEnF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,KACzC,MAAM,GAAG,SAGX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,KACzC;IACD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACxC,iBAAiB,EAAE,OAAO,CAAC;CAc5B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResolvedFontStyle = exports.useResolvedFontFamily = exports.useFontRegistry = exports.FontRegistryProvider = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const registry_1 = require("./registry");
|
|
6
|
+
const FontRegistryContext = (0, react_1.createContext)({});
|
|
7
|
+
exports.FontRegistryProvider = FontRegistryContext.Provider;
|
|
8
|
+
const useFontRegistry = () => (0, react_1.useContext)(FontRegistryContext);
|
|
9
|
+
exports.useFontRegistry = useFontRegistry;
|
|
10
|
+
const useResolvedFontFamily = (family, weight) => {
|
|
11
|
+
const registry = (0, exports.useFontRegistry)();
|
|
12
|
+
return (0, react_1.useMemo)(() => (0, registry_1.resolveFontFamily)(registry, family, weight), [registry, family, weight]);
|
|
13
|
+
};
|
|
14
|
+
exports.useResolvedFontFamily = useResolvedFontFamily;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves a `family + weight` request to a registered font name. Returns
|
|
17
|
+
* `resolvedToVariant: true` when the registry matched a concrete weighted
|
|
18
|
+
* variant — callers should then suppress `fontWeight` on the rendered Text to
|
|
19
|
+
* avoid synthetic emboldening on top of an already-weighted font file.
|
|
20
|
+
*/
|
|
21
|
+
const useResolvedFontStyle = (family, weight) => {
|
|
22
|
+
const registry = (0, exports.useFontRegistry)();
|
|
23
|
+
return (0, react_1.useMemo)(() => {
|
|
24
|
+
const fontFamily = (0, registry_1.resolveFontFamily)(registry, family, weight);
|
|
25
|
+
const variants = family ? registry === null || registry === void 0 ? void 0 : registry[family] : undefined;
|
|
26
|
+
const resolvedToVariant = !!variants && fontFamily !== undefined && fontFamily !== family;
|
|
27
|
+
return {
|
|
28
|
+
fontFamily,
|
|
29
|
+
fontWeight: resolvedToVariant ? undefined : (weight !== null && weight !== void 0 ? weight : undefined),
|
|
30
|
+
resolvedToVariant,
|
|
31
|
+
};
|
|
32
|
+
}, [registry, family, weight]);
|
|
33
|
+
};
|
|
34
|
+
exports.useResolvedFontStyle = useResolvedFontStyle;
|
|
35
|
+
//# sourceMappingURL=FontRegistryContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontRegistryContext.js","sourceRoot":"","sources":["../../../src/infra/fonts/FontRegistryContext.tsx"],"names":[],"mappings":";;;AAAA,iCAA2D;AAE3D,yCAA+C;AAE/C,MAAM,mBAAmB,GAAG,IAAA,qBAAa,EAAe,EAAE,CAAC,CAAC;AAE/C,QAAA,oBAAoB,GAAG,mBAAmB,CAAC,QAAQ,CAAC;AAE1D,MAAM,eAAe,GAAG,GAAiB,EAAE,CAAC,IAAA,kBAAU,EAAC,mBAAmB,CAAC,CAAC;AAAtE,QAAA,eAAe,mBAAuD;AAE5E,MAAM,qBAAqB,GAAG,CACnC,MAAiC,EACjC,MAA0C,EACtB,EAAE;IACtB,MAAM,QAAQ,GAAG,IAAA,uBAAe,GAAE,CAAC;IACnC,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,4BAAiB,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC;AANW,QAAA,qBAAqB,yBAMhC;AAEF;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,CAClC,MAAiC,EACjC,MAA0C,EAK1C,EAAE;IACF,MAAM,QAAQ,GAAG,IAAA,uBAAe,GAAE,CAAC;IACnC,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,MAAM,UAAU,GAAG,IAAA,4BAAiB,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzD,MAAM,iBAAiB,GACrB,CAAC,CAAC,QAAQ,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,MAAM,CAAC;QAClE,OAAO;YACL,UAAU;YACV,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,CAAC;YACjE,iBAAiB;SAClB,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infra/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResolvedFontStyle = exports.useResolvedFontFamily = exports.useFontRegistry = exports.FontRegistryProvider = exports.normalizeWeight = exports.resolveFontFamily = exports.registerFonts = void 0;
|
|
4
|
+
var registry_1 = require("./registry");
|
|
5
|
+
Object.defineProperty(exports, "registerFonts", { enumerable: true, get: function () { return registry_1.registerFonts; } });
|
|
6
|
+
Object.defineProperty(exports, "resolveFontFamily", { enumerable: true, get: function () { return registry_1.resolveFontFamily; } });
|
|
7
|
+
Object.defineProperty(exports, "normalizeWeight", { enumerable: true, get: function () { return registry_1.normalizeWeight; } });
|
|
8
|
+
var FontRegistryContext_1 = require("./FontRegistryContext");
|
|
9
|
+
Object.defineProperty(exports, "FontRegistryProvider", { enumerable: true, get: function () { return FontRegistryContext_1.FontRegistryProvider; } });
|
|
10
|
+
Object.defineProperty(exports, "useFontRegistry", { enumerable: true, get: function () { return FontRegistryContext_1.useFontRegistry; } });
|
|
11
|
+
Object.defineProperty(exports, "useResolvedFontFamily", { enumerable: true, get: function () { return FontRegistryContext_1.useResolvedFontFamily; } });
|
|
12
|
+
Object.defineProperty(exports, "useResolvedFontStyle", { enumerable: true, get: function () { return FontRegistryContext_1.useResolvedFontStyle; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infra/fonts/index.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAJlB,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,2GAAA,eAAe,OAAA;AAGjB,6DAK+B;AAJ7B,2HAAA,oBAAoB,OAAA;AACpB,sHAAA,eAAe,OAAA;AACf,4HAAA,qBAAqB,OAAA;AACrB,2HAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FontsManifest, FontWeightKey } from "../../types";
|
|
2
|
+
export type FontRegistry = Record<string, Record<number, string>>;
|
|
3
|
+
export declare const normalizeWeight: (key: FontWeightKey | string | number | undefined) => number;
|
|
4
|
+
export declare const registerFonts: (manifest: FontsManifest | undefined) => Promise<FontRegistry>;
|
|
5
|
+
export declare const resolveFontFamily: (registry: FontRegistry | null | undefined, family: string | null | undefined, weight: string | number | null | undefined) => string | undefined;
|
|
6
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/infra/fonts/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAUlE,eAAO,MAAM,eAAe,GAAI,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,KAAG,MAOlF,CAAC;AAmBF,eAAO,MAAM,aAAa,GAAU,UAAU,aAAa,GAAG,SAAS,KAAG,OAAO,CAAC,YAAY,CAiC7F,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,UAAU,YAAY,GAAG,IAAI,GAAG,SAAS,EACzC,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,QAAQ,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,KACzC,MAAM,GAAG,SA0BX,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveFontFamily = exports.registerFonts = exports.normalizeWeight = void 0;
|
|
4
|
+
const WEIGHT_NAME_TO_NUM = {
|
|
5
|
+
regular: 400,
|
|
6
|
+
medium: 500,
|
|
7
|
+
semibold: 600,
|
|
8
|
+
bold: 700,
|
|
9
|
+
extrabold: 800,
|
|
10
|
+
};
|
|
11
|
+
const normalizeWeight = (key) => {
|
|
12
|
+
if (key === undefined || key === null)
|
|
13
|
+
return 400;
|
|
14
|
+
if (typeof key === "number")
|
|
15
|
+
return key;
|
|
16
|
+
const named = WEIGHT_NAME_TO_NUM[key];
|
|
17
|
+
if (named)
|
|
18
|
+
return named;
|
|
19
|
+
const parsed = parseInt(key, 10);
|
|
20
|
+
return Number.isFinite(parsed) ? parsed : 400;
|
|
21
|
+
};
|
|
22
|
+
exports.normalizeWeight = normalizeWeight;
|
|
23
|
+
const buildRegisteredName = (family, weight) => `${family}-${weight}`;
|
|
24
|
+
let expoFontWarned = false;
|
|
25
|
+
const loadExpoFont = () => {
|
|
26
|
+
try {
|
|
27
|
+
return require("expo-font");
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
if (!expoFontWarned) {
|
|
31
|
+
console.warn("[onboarding] `fonts` manifest provided but `expo-font` is not installed. Skipping runtime font registration.");
|
|
32
|
+
expoFontWarned = true;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const registerFonts = async (manifest) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const registry = {};
|
|
40
|
+
if (!manifest || Object.keys(manifest).length === 0)
|
|
41
|
+
return registry;
|
|
42
|
+
const Font = loadExpoFont();
|
|
43
|
+
if (!Font)
|
|
44
|
+
return registry;
|
|
45
|
+
const loads = [];
|
|
46
|
+
for (const [family, variants] of Object.entries(manifest)) {
|
|
47
|
+
if (!variants)
|
|
48
|
+
continue;
|
|
49
|
+
registry[family] = (_a = registry[family]) !== null && _a !== void 0 ? _a : {};
|
|
50
|
+
for (const [weightKey, url] of Object.entries(variants)) {
|
|
51
|
+
if (!url)
|
|
52
|
+
continue;
|
|
53
|
+
const weight = (0, exports.normalizeWeight)(weightKey);
|
|
54
|
+
const registeredName = buildRegisteredName(family, weight);
|
|
55
|
+
registry[family][weight] = registeredName;
|
|
56
|
+
loads.push(Font.loadAsync({ [registeredName]: { uri: url } }).catch((error) => {
|
|
57
|
+
console.warn(`[onboarding] Failed to load font "${family}" weight ${weight} from ${url}:`, error);
|
|
58
|
+
delete registry[family][weight];
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
await Promise.all(loads);
|
|
63
|
+
return registry;
|
|
64
|
+
};
|
|
65
|
+
exports.registerFonts = registerFonts;
|
|
66
|
+
const resolveFontFamily = (registry, family, weight) => {
|
|
67
|
+
if (!family)
|
|
68
|
+
return undefined;
|
|
69
|
+
if (!registry)
|
|
70
|
+
return family;
|
|
71
|
+
const variants = registry[family];
|
|
72
|
+
if (!variants)
|
|
73
|
+
return family;
|
|
74
|
+
const requested = (0, exports.normalizeWeight)(weight);
|
|
75
|
+
const exact = variants[requested];
|
|
76
|
+
if (exact)
|
|
77
|
+
return exact;
|
|
78
|
+
const available = Object.keys(variants)
|
|
79
|
+
.map(Number)
|
|
80
|
+
.filter((n) => Number.isFinite(n))
|
|
81
|
+
.sort((a, b) => a - b);
|
|
82
|
+
if (available.length === 0)
|
|
83
|
+
return family;
|
|
84
|
+
let best = available[0];
|
|
85
|
+
let bestDelta = Math.abs(best - requested);
|
|
86
|
+
for (const candidate of available) {
|
|
87
|
+
const delta = Math.abs(candidate - requested);
|
|
88
|
+
if (delta < bestDelta) {
|
|
89
|
+
best = candidate;
|
|
90
|
+
bestDelta = delta;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return variants[best];
|
|
94
|
+
};
|
|
95
|
+
exports.resolveFontFamily = resolveFontFamily;
|
|
96
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/infra/fonts/registry.ts"],"names":[],"mappings":";;;AAIA,MAAM,kBAAkB,GAA2B;IACjD,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,GAAG;CACf,CAAC;AAEK,MAAM,eAAe,GAAG,CAAC,GAAgD,EAAU,EAAE;IAC1F,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IAClD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,KAAK;QAA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E,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACpC,GAAG,CAAC,MAAM,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SACjC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAE1C,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IAC3C,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;QAC9C,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;YACtB,IAAI,GAAG,SAAS,CAAC;YACjB,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B"}
|
package/dist/infra/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/infra/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./provider"), exports);
|
|
18
18
|
__exportStar(require("./hooks"), exports);
|
|
19
|
+
__exportStar(require("./fonts"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/infra/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infra/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FontsManifest } from "../../types";
|
|
2
|
+
interface FontLoaderGateProps {
|
|
3
|
+
fonts: FontsManifest | undefined;
|
|
4
|
+
fallback?: React.ReactNode;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const FontLoaderGate: ({ fonts, fallback, children }: FontLoaderGateProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=FontLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontLoader.d.ts","sourceRoot":"","sources":["../../../src/infra/provider/FontLoader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,GAAI,+BAAsC,mBAAmB,4CA4BvF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FontLoaderGate = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const FontRegistryContext_1 = require("../fonts/FontRegistryContext");
|
|
7
|
+
const registry_1 = require("../fonts/registry");
|
|
8
|
+
const FontLoaderGate = ({ fonts, fallback = null, children }) => {
|
|
9
|
+
const hasFonts = !!fonts && Object.keys(fonts).length > 0;
|
|
10
|
+
const [registry, setRegistry] = (0, react_1.useState)(hasFonts ? null : {});
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
if (!hasFonts) {
|
|
13
|
+
setRegistry({});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let cancelled = false;
|
|
17
|
+
setRegistry(null);
|
|
18
|
+
(0, registry_1.registerFonts)(fonts)
|
|
19
|
+
.then((result) => {
|
|
20
|
+
if (!cancelled)
|
|
21
|
+
setRegistry(result);
|
|
22
|
+
})
|
|
23
|
+
.catch((err) => {
|
|
24
|
+
if (!cancelled) {
|
|
25
|
+
console.error("[onboarding] Font registration failed:", err);
|
|
26
|
+
setRegistry({});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return () => {
|
|
30
|
+
cancelled = true;
|
|
31
|
+
};
|
|
32
|
+
}, [fonts, hasFonts]);
|
|
33
|
+
if (registry === null)
|
|
34
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fallback });
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(FontRegistryContext_1.FontRegistryProvider, { value: registry, children: children });
|
|
36
|
+
};
|
|
37
|
+
exports.FontLoaderGate = FontLoaderGate;
|
|
38
|
+
//# sourceMappingURL=FontLoader.js.map
|
|
@@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AQ,KAAK,IAAI;QAAE,OAAO,2DAAG,QAAQ,GAAI,CAAC;IAC9C,OAAO,uBAAC,0CAAoB,IAAC,KAAK,EAAE,QAAQ,YAAG,QAAQ,GAAwB,CAAC;AAClF,CAAC,CAAC;AA5BW,QAAA,cAAc,kBA4BzB"}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { OnboardingStudioClient } from "../../OnboardingStudioClient";
|
|
2
2
|
import { Onboarding } from "../../types";
|
|
3
3
|
import { OnboardingStepType } from "../../steps/types";
|
|
4
|
+
import { ComposableVariableEntry } from "../../steps/ComposableScreen/types";
|
|
5
|
+
export type CustomActionHandler = (args: {
|
|
6
|
+
variables: Record<string, ComposableVariableEntry | undefined>;
|
|
7
|
+
}) => void | Promise<void>;
|
|
8
|
+
export type CustomActions = Record<string, CustomActionHandler>;
|
|
4
9
|
interface OnboardingProviderProps {
|
|
5
10
|
children: React.ReactNode;
|
|
6
11
|
client: OnboardingStudioClient;
|
|
7
12
|
locale?: string;
|
|
8
13
|
customAudienceParams?: Record<string, any>;
|
|
14
|
+
/**
|
|
15
|
+
* Map of named handlers invokable from ComposableScreen Button `actions`
|
|
16
|
+
* with `{ type: "custom", function: <name>, variables?: [...] }`. Handlers
|
|
17
|
+
* receive the requested variables filtered from the live ComposableScreen
|
|
18
|
+
* variable map and may return a Promise.
|
|
19
|
+
*/
|
|
20
|
+
customActions?: CustomActions;
|
|
21
|
+
/**
|
|
22
|
+
* Rendered while the onboarding payload is fetched and any remote fonts
|
|
23
|
+
* declared in the response (`onboarding.fonts`) are downloaded and registered.
|
|
24
|
+
* Defaults to `null`.
|
|
25
|
+
*/
|
|
26
|
+
fontsFallback?: React.ReactNode;
|
|
9
27
|
}
|
|
10
|
-
export declare const OnboardingProvider: ({ children, client, locale, customAudienceParams, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const OnboardingProvider: ({ children, client, locale, customAudienceParams, customActions, fontsFallback, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
29
|
export declare const OnboardingProgressContext: import("react").Context<{
|
|
12
30
|
activeStep: {
|
|
13
31
|
number: number;
|
|
@@ -26,6 +44,7 @@ export declare const OnboardingProgressContext: import("react").Context<{
|
|
|
26
44
|
setOnboarding: (onboarding: Onboarding<OnboardingStepType>) => void;
|
|
27
45
|
variables: Record<string, any>;
|
|
28
46
|
setVariable: (name: string, value: any) => void;
|
|
47
|
+
customActions: CustomActions;
|
|
29
48
|
}>;
|
|
30
49
|
export {};
|
|
31
50
|
//# sourceMappingURL=OnboardingProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingProvider.d.ts","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"OnboardingProvider.d.ts","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAW7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,SAAS,CAAC,CAAC;CAChE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3B,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEhE,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3C;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC;AAiCD,eAAO,MAAM,kBAAkB,GAAI,mFAOhC,uBAAuB,4CA0CzB,CAAC;AAEF,eAAO,MAAM,yBAAyB;gBACxB;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,qBAAqB,EAAE,OAAO,CAAA;KAAE;mBAC/C,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,qBAAqB,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI;gBACrE,MAAM;mBACH,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;YAC9B,sBAAsB;YACtB,MAAM;0BACQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAC7B,UAAU,CAAC,kBAAkB,CAAC,GAAG,IAAI;mBAClC,CAAC,UAAU,EAAE,UAAU,CAAC,kBAAkB,CAAC,KAAK,IAAI;eACxD,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;iBACjB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI;mBAChC,aAAa;EAc5B,CAAC"}
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
7
|
const OnboardingStudioClient_1 = require("../../OnboardingStudioClient");
|
|
8
8
|
const getOnboarding_query_1 = require("../queries/getOnboarding.query");
|
|
9
|
+
const FontLoader_1 = require("./FontLoader");
|
|
9
10
|
const queryClient = new react_query_1.QueryClient({
|
|
10
11
|
defaultOptions: {
|
|
11
12
|
queries: {
|
|
@@ -13,7 +14,15 @@ const queryClient = new react_query_1.QueryClient({
|
|
|
13
14
|
},
|
|
14
15
|
},
|
|
15
16
|
});
|
|
16
|
-
const
|
|
17
|
+
const OnboardingDataGate = ({ client, locale, customAudienceParams, setOnboarding, fontsFallback, children, }) => {
|
|
18
|
+
const { data, error } = (0, react_query_1.useQuery)((0, getOnboarding_query_1.getOnboardingQuery)(client, locale, customAudienceParams, setOnboarding));
|
|
19
|
+
if (error)
|
|
20
|
+
throw error;
|
|
21
|
+
if (!data)
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fontsFallback !== null && fontsFallback !== void 0 ? fontsFallback : null });
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(FontLoader_1.FontLoaderGate, { fonts: data.fonts, fallback: fontsFallback, children: children }));
|
|
24
|
+
};
|
|
25
|
+
const OnboardingProvider = ({ children, client, locale = "en", customAudienceParams = {}, customActions = {}, fontsFallback, }) => {
|
|
17
26
|
const [activeStep, setActiveStep] = (0, react_1.useState)({
|
|
18
27
|
number: 0,
|
|
19
28
|
displayProgressHeader: false,
|
|
@@ -24,7 +33,6 @@ const OnboardingProvider = ({ children, client, locale = "en", customAudiencePar
|
|
|
24
33
|
const setVariable = (0, react_1.useCallback)((name, value) => {
|
|
25
34
|
setVariables((prev) => (Object.assign(Object.assign({}, prev), { [name]: value })));
|
|
26
35
|
}, []);
|
|
27
|
-
queryClient.prefetchQuery((0, getOnboarding_query_1.getOnboardingQuery)(client, locale, customAudienceParams, setOnboarding));
|
|
28
36
|
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(exports.OnboardingProgressContext.Provider, { value: {
|
|
29
37
|
activeStep,
|
|
30
38
|
setActiveStep,
|
|
@@ -37,7 +45,8 @@ const OnboardingProvider = ({ children, client, locale = "en", customAudiencePar
|
|
|
37
45
|
setOnboarding,
|
|
38
46
|
variables,
|
|
39
47
|
setVariable,
|
|
40
|
-
|
|
48
|
+
customActions,
|
|
49
|
+
}, children: (0, jsx_runtime_1.jsx)(OnboardingDataGate, { client: client, locale: locale, customAudienceParams: customAudienceParams, setOnboarding: setOnboarding, fontsFallback: fontsFallback, children: children }) }) }));
|
|
41
50
|
};
|
|
42
51
|
exports.OnboardingProvider = OnboardingProvider;
|
|
43
52
|
exports.OnboardingProgressContext = (0, react_1.createContext)({
|
|
@@ -52,5 +61,6 @@ exports.OnboardingProgressContext = (0, react_1.createContext)({
|
|
|
52
61
|
setOnboarding: () => { },
|
|
53
62
|
variables: {},
|
|
54
63
|
setVariable: () => { },
|
|
64
|
+
customActions: {},
|
|
55
65
|
});
|
|
56
66
|
//# sourceMappingURL=OnboardingProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingProvider.js","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"OnboardingProvider.js","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAA6D;AAC7D,uDAAmF;AACnF,yEAAsE;AACtE,wEAAoE;AAIpE,6CAA8C;AAE9C,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC;IAClC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC,CAAA;AAqCF,MAAM,kBAAkB,GAAG,CAAC,EAC1B,MAAM,EACN,MAAM,EACN,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,QAAQ,GACgB,EAAE,EAAE;IAC5B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAA,sBAAQ,EAC9B,IAAA,wCAAkB,EAAqB,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,aAAa,CAAC,CAC5F,CAAC;IAEF,IAAI,KAAK;Q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AM;gBACN,oBAAoB;gBACpB,UAAU;gBACV,aAAa;gBACb,SAAS;gBACT,WAAW;gBACX,aAAa;aACd,YAED,uBAAC,kBAAkB,IACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,oBAAoB,EAC1C,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,YAE3B,QAAQ,GACU,GACc,GACjB,CACvB,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,kBAAkB,sBAiD7B;AAEW,QAAA,yBAAyB,GAAG,IAAA,qBAAa,EAanD;IACD,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAE;IACvD,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC;IACxB,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC;IACxB,MAAM,EAAE,IAAI,+CAAsB,CAAC,EAAE,EAAE,EAAE,CAAC;IAC1C,MAAM,EAAE,IAAI;IACZ,oBAAoB,EAAE,EAAE;IACxB,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC;IACtB,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infra/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infra/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mBAAmB,EACnB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OnboardingProgressContext = exports.OnboardingProvider = void 0;
|
|
3
|
+
exports.FontLoaderGate = exports.OnboardingProgressContext = exports.OnboardingProvider = void 0;
|
|
4
4
|
var OnboardingProvider_1 = require("./OnboardingProvider");
|
|
5
5
|
Object.defineProperty(exports, "OnboardingProvider", { enumerable: true, get: function () { return OnboardingProvider_1.OnboardingProvider; } });
|
|
6
6
|
Object.defineProperty(exports, "OnboardingProgressContext", { enumerable: true, get: function () { return OnboardingProvider_1.OnboardingProgressContext; } });
|
|
7
|
+
var FontLoader_1 = require("./FontLoader");
|
|
8
|
+
Object.defineProperty(exports, "FontLoaderGate", { enumerable: true, get: function () { return FontLoader_1.FontLoaderGate; } });
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infra/provider/index.ts"],"names":[],"mappings":";;;AAAA,2DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAClB,+HAAA,yBAAyB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infra/provider/index.ts"],"names":[],"mappings":";;;AAAA,2DAG8B;AAF5B,wHAAA,kBAAkB,OAAA;AAClB,+HAAA,yBAAyB,OAAA;AAM3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA"}
|