@rocapine/react-native-onboarding 1.59.2 → 1.61.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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/infra/navigation/expoRouterAdapter.js +1 -1
- package/dist/infra/navigation/expoRouterAdapter.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts +12 -1
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +15 -1
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/products/adapters/expoIap.d.ts +4 -0
- package/dist/products/adapters/expoIap.d.ts.map +1 -0
- package/dist/products/adapters/expoIap.js +95 -0
- package/dist/products/adapters/expoIap.js.map +1 -0
- package/dist/products/adapters/revenueCat.d.ts +7 -0
- package/dist/products/adapters/revenueCat.d.ts.map +1 -0
- package/dist/products/adapters/revenueCat.js +116 -0
- package/dist/products/adapters/revenueCat.js.map +1 -0
- package/dist/products/adapters/stub.d.ts +8 -0
- package/dist/products/adapters/stub.d.ts.map +1 -0
- package/dist/products/adapters/stub.js +21 -0
- package/dist/products/adapters/stub.js.map +1 -0
- package/dist/products/derive.d.ts +19 -0
- package/dist/products/derive.d.ts.map +1 -0
- package/dist/products/derive.js +79 -0
- package/dist/products/derive.js.map +1 -0
- package/dist/products/duration.d.ts +3 -0
- package/dist/products/duration.d.ts.map +1 -0
- package/dist/products/duration.js +25 -0
- package/dist/products/duration.js.map +1 -0
- package/dist/products/index.d.ts +9 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +20 -0
- package/dist/products/index.js.map +1 -0
- package/dist/products/toVariables.d.ts +18 -0
- package/dist/products/toVariables.d.ts.map +1 -0
- package/dist/products/toVariables.js +52 -0
- package/dist/products/toVariables.js.map +1 -0
- package/dist/products/types.d.ts +96 -0
- package/dist/products/types.d.ts.map +1 -0
- package/dist/products/types.js +3 -0
- package/dist/products/types.js.map +1 -0
- package/dist/products/useProducts.d.ts +12 -0
- package/dist/products/useProducts.d.ts.map +1 -0
- package/dist/products/useProducts.js +90 -0
- package/dist/products/useProducts.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.d.ts +1 -24
- package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -0
- package/dist/screens/elements/AnimatedTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.d.ts +2 -25
- package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.js +1 -1
- package/dist/screens/elements/BaseBoxProps.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.d.ts +8 -123
- package/dist/screens/elements/ButtonElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.js +2 -2
- package/dist/screens/elements/ButtonElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.d.ts +1 -24
- package/dist/screens/elements/CarouselElement.d.ts.map +1 -0
- package/dist/screens/elements/CarouselElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.d.ts +2 -25
- package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.js +1 -1
- package/dist/screens/elements/CheckboxGroupElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.d.ts +1 -24
- package/dist/screens/elements/DatePickerElement.d.ts.map +1 -0
- package/dist/screens/elements/DatePickerElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.d.ts +1 -24
- package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -0
- package/dist/screens/elements/DrawingPadElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/IconElement.d.ts +1 -24
- package/dist/screens/elements/IconElement.d.ts.map +1 -0
- package/dist/screens/elements/IconElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.d.ts +1 -24
- package/dist/screens/elements/ImageElement.d.ts.map +1 -0
- package/dist/screens/elements/ImageElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/InputElement.d.ts +1 -24
- package/dist/screens/elements/InputElement.d.ts.map +1 -0
- package/dist/screens/elements/InputElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.d.ts +1 -24
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -0
- package/dist/screens/elements/KeyboardAvoidingViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.d.ts +1 -24
- package/dist/screens/elements/LottieElement.d.ts.map +1 -0
- package/dist/screens/elements/LottieElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.d.ts +1 -24
- package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -0
- package/dist/screens/elements/ProgressIndicatorElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.d.ts +1 -24
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -0
- package/dist/screens/elements/ProgressiveBlurImageElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.d.ts +2 -25
- package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.js +1 -1
- package/dist/screens/elements/RadioGroupElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.d.ts +1 -24
- package/dist/screens/elements/RichTextElement.d.ts.map +1 -0
- package/dist/screens/elements/RichTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.d.ts +1 -24
- package/dist/screens/elements/RiveElement.d.ts.map +1 -0
- package/dist/screens/elements/RiveElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.d.ts +1 -24
- package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -0
- package/dist/screens/elements/SafeAreaViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.d.ts +1 -24
- package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -0
- package/dist/screens/elements/ScrollViewElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.d.ts +1 -24
- package/dist/screens/elements/SliderElement.d.ts.map +1 -0
- package/dist/screens/elements/SliderElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/StackElement.d.ts +1 -24
- package/dist/screens/elements/StackElement.d.ts.map +1 -0
- package/dist/screens/elements/StackElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/TextElement.d.ts +1 -24
- package/dist/screens/elements/TextElement.d.ts.map +1 -0
- package/dist/screens/elements/TextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.d.ts +1 -24
- package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -0
- package/dist/screens/elements/TypewriterTextElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.d.ts +1 -24
- package/dist/screens/elements/VideoElement.d.ts.map +1 -0
- package/dist/screens/elements/VideoElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.d.ts +1 -24
- package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -0
- package/dist/screens/elements/WheelPickerElement.js.map +1 -0
- package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.d.ts +1 -24
- package/dist/screens/elements/ZStackElement.d.ts.map +1 -0
- package/dist/screens/elements/ZStackElement.js.map +1 -0
- package/dist/screens/types.d.ts +242 -0
- package/dist/screens/types.d.ts.map +1 -0
- package/dist/screens/types.js +272 -0
- package/dist/screens/types.js.map +1 -0
- package/dist/steps/Carousel/types.d.ts +1 -1
- package/dist/steps/Commitment/types.d.ts +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +5 -236
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/types.js +23 -262
- package/dist/steps/ComposableScreen/types.js.map +1 -1
- package/dist/steps/Loader/types.d.ts +1 -1
- package/dist/steps/MediaContent/types.d.ts +1 -1
- package/dist/steps/Picker/types.d.ts +1 -1
- package/dist/steps/Question/types.d.ts +1 -1
- package/dist/steps/Ratings/types.d.ts +1 -1
- package/dist/steps/common.types.d.ts +23 -30
- package/dist/steps/common.types.d.ts.map +1 -1
- package/dist/steps/common.types.js +18 -3
- package/dist/steps/common.types.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/productAdapters.test.ts +58 -0
- package/src/__tests__/productDerive.test.ts +111 -0
- package/src/__tests__/productVariables.test.ts +109 -0
- package/src/__tests__/screenTypesBackCompat.test.ts +58 -0
- package/src/index.ts +2 -0
- package/src/infra/navigation/expoRouterAdapter.ts +1 -1
- package/src/infra/provider/OnboardingProvider.tsx +29 -0
- package/src/products/adapters/expoIap.ts +93 -0
- package/src/products/adapters/revenueCat.ts +108 -0
- package/src/products/adapters/stub.ts +20 -0
- package/src/products/derive.ts +93 -0
- package/src/products/duration.ts +21 -0
- package/src/products/index.ts +19 -0
- package/src/products/toVariables.ts +54 -0
- package/src/products/types.ts +88 -0
- package/src/products/useProducts.ts +106 -0
- package/src/{steps/ComposableScreen → screens}/elements/BaseBoxProps.ts +1 -1
- package/src/{steps/ComposableScreen → screens}/elements/ButtonElement.ts +2 -2
- package/src/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.ts +1 -1
- package/src/{steps/ComposableScreen → screens}/elements/RadioGroupElement.ts +1 -1
- package/src/screens/types.ts +535 -0
- package/src/steps/ComposableScreen/types.ts +9 -528
- package/src/steps/common.types.ts +50 -6
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/IconElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/InputElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RichTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RichTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/StackElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/TextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/TypewriterTextElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.js.map +0 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +0 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.js.map +0 -1
- /package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/IconElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/InputElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/StackElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/TextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.js +0 -0
- /package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.js +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/CarouselElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/DatePickerElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/DrawingPadElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/IconElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ImageElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/InputElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/LottieElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/RichTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/RiveElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ScrollViewElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/SliderElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/StackElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/TextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/VideoElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/WheelPickerElement.ts +0 -0
- /package/src/{steps/ComposableScreen → screens}/elements/ZStackElement.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { evaluateCondition, evaluateLeaf, isConditionGroup } from "./evaluateCon
|
|
|
13
13
|
export type { Condition } from "./evaluateCondition";
|
|
14
14
|
export type { LeafCondition, ConditionGroup, ConditionValue, ConditionOperator, Branch, NextStep, } from "./steps/common.types";
|
|
15
15
|
export { BaseStepTypeSchema, LeafConditionSchema, ConditionGroupSchema, BranchSchema, NextStepSchema, ConditionOperatorSchema, ConditionValueSchema, UNARY_CONDITION_OPERATORS, isUnaryConditionOperator, ONBOARDING_END_STEP_ID, } from "./steps/common.types";
|
|
16
|
+
export * from "./products";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
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,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gCAAgC,EAChC,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxF,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,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,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,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,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,gCAAgC,EAChC,QAAQ,EACR,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,YAAY,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxF,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,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,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -55,4 +55,6 @@ Object.defineProperty(exports, "ConditionValueSchema", { enumerable: true, get:
|
|
|
55
55
|
Object.defineProperty(exports, "UNARY_CONDITION_OPERATORS", { enumerable: true, get: function () { return common_types_1.UNARY_CONDITION_OPERATORS; } });
|
|
56
56
|
Object.defineProperty(exports, "isUnaryConditionOperator", { enumerable: true, get: function () { return common_types_1.isUnaryConditionOperator; } });
|
|
57
57
|
Object.defineProperty(exports, "ONBOARDING_END_STEP_ID", { enumerable: true, get: function () { return common_types_1.ONBOARDING_END_STEP_ID; } });
|
|
58
|
+
// Product runtime (paywall phase 3) — vendor-neutral store products
|
|
59
|
+
__exportStar(require("./products"), exports);
|
|
58
60
|
//# sourceMappingURL=index.js.map
|
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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AAA,6BAA6B,OAAA;AAC7B,sHAAA,6BAA6B,OAAA;AAC7B,gHAAA,uBAAuB,OAAA;AAEzB,sBAAsB;AACtB,0CAAwB;AAGxB,0EAAyE;AAAhE,sHAAA,iBAAiB,OAAA;AAC1B,YAAY;AACZ,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,yDAAwF;AAA/E,sHAAA,iBAAiB,OAAA;AAAE,iHAAA,YAAY,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAU1D,qDAW8B;AAV5B,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;AACpB,yHAAA,yBAAyB,OAAA;AACzB,wHAAA,wBAAwB,OAAA;AACxB,sHAAA,sBAAsB,OAAA;AAExB,oEAAoE;AACpE,6CAA2B"}
|
|
@@ -5,7 +5,7 @@ exports.expoRouterAdapter = void 0;
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
// expo-router is an OPTIONAL peer dependency. Lazily require it so the SDK
|
|
7
7
|
// loads (and the no-op fallbacks below take over) when it is not installed.
|
|
8
|
-
// Precedent:
|
|
8
|
+
// Precedent: UI/Runtime/elements/haptics.ts (try/require/catch).
|
|
9
9
|
let expoRouter;
|
|
10
10
|
try {
|
|
11
11
|
expoRouter = require("expo-router");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expoRouterAdapter.js","sourceRoot":"","sources":["../../../src/infra/navigation/expoRouterAdapter.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC,2EAA2E;AAC3E,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"expoRouterAdapter.js","sourceRoot":"","sources":["../../../src/infra/navigation/expoRouterAdapter.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC,2EAA2E;AAC3E,4EAA4E;AAC5E,iEAAiE;AACjE,IAAI,UAAe,CAAC;AACpB,IAAI,CAAC;IACH,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACtC,CAAC;AAAC,WAAM,CAAC;IACP,+DAA+D;AACjE,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,iBAAiB,GAAgC;IAC5D,cAAc,EACZ,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,cAAc,mCAC1B,CAAC,CAAC,MAAiC,EAAE,EAAE;QACrC,IAAA,iBAAS,EAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,CAAC,CAAC;IACJ,SAAS,EAAE,UAAU;QACnB,CAAC,CAAC,GAAG,EAAE;YACH,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;YACtC,OAAO;gBACL,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;gBACnC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;aAC5B,CAAC;QACJ,CAAC;QACH,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;CACzD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Onboarding, OnboardingMetadata } from "../../types";
|
|
|
3
3
|
import { OnboardingStepType } from "../../steps/types";
|
|
4
4
|
import { ComposableVariableEntry } from "../../steps/ComposableScreen/types";
|
|
5
5
|
import { OnboardingNavigationAdapter } from "../navigation/types";
|
|
6
|
+
import { ProductProvider, ProductRef, ProductRuntime } from "../../products/types";
|
|
6
7
|
export type CustomActionHandler = (args: {
|
|
7
8
|
variables: Record<string, ComposableVariableEntry | undefined>;
|
|
8
9
|
/**
|
|
@@ -59,8 +60,17 @@ interface OnboardingProviderProps {
|
|
|
59
60
|
* logic (mark onboarding done, navigate to paywall/home, etc.). Optional.
|
|
60
61
|
*/
|
|
61
62
|
onComplete?: OnboardingCompleteHandler;
|
|
63
|
+
/**
|
|
64
|
+
* Billing adapter. Omit for an app with no paywall. Must be a stable reference.
|
|
65
|
+
*/
|
|
66
|
+
productProvider?: ProductProvider;
|
|
67
|
+
/**
|
|
68
|
+
* Product slots to resolve at mount, e.g.
|
|
69
|
+
* `[{ key: "yearly", ios: "com.app.yr", android: "com.app.yr:p1y", compareTo: "monthly" }]`.
|
|
70
|
+
*/
|
|
71
|
+
productRefs?: ProductRef[];
|
|
62
72
|
}
|
|
63
|
-
export declare const OnboardingProvider: ({ children, client, locale, customAudienceParams, customActions, fontsFallback, navigation, onComplete, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare const OnboardingProvider: ({ children, client, locale, customAudienceParams, customActions, fontsFallback, navigation, onComplete, productProvider, productRefs, }: OnboardingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
64
74
|
export declare const OnboardingProgressContext: import("react").Context<{
|
|
65
75
|
activeStep: {
|
|
66
76
|
number: number;
|
|
@@ -85,6 +95,7 @@ export declare const OnboardingProgressContext: import("react").Context<{
|
|
|
85
95
|
completeOnboarding: () => void;
|
|
86
96
|
customActions: CustomActions;
|
|
87
97
|
navigation: OnboardingNavigationAdapter;
|
|
98
|
+
products: ProductRuntime;
|
|
88
99
|
}>;
|
|
89
100
|
export {};
|
|
90
101
|
//# 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,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO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BACjC,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;wBACnB,MAAM,IAAI;mBACf,aAAa;gBAChB,2BAA2B;cAC7B,cAAc;EAoBxB,CAAC"}
|
|
@@ -10,6 +10,7 @@ const FontLoader_1 = require("./FontLoader");
|
|
|
10
10
|
const extractAssetUrls_1 = require("../preload/extractAssetUrls");
|
|
11
11
|
const preloadAssets_1 = require("../preload/preloadAssets");
|
|
12
12
|
const expoRouterAdapter_1 = require("../navigation/expoRouterAdapter");
|
|
13
|
+
const useProducts_1 = require("../../products/useProducts");
|
|
13
14
|
const queryClient = new react_query_1.QueryClient({
|
|
14
15
|
defaultOptions: {
|
|
15
16
|
queries: {
|
|
@@ -17,6 +18,16 @@ const queryClient = new react_query_1.QueryClient({
|
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
});
|
|
21
|
+
// Module-scope so the context default is referentially stable — an inline
|
|
22
|
+
// object literal here would allocate a fresh value on every read of the
|
|
23
|
+
// default, defeating the same stability contract useProducts upholds.
|
|
24
|
+
const EMPTY_PRODUCT_RUNTIME = {
|
|
25
|
+
products: {},
|
|
26
|
+
status: "idle",
|
|
27
|
+
purchasing: false,
|
|
28
|
+
purchase: async () => ({ status: "error", error: new Error("No ProductProvider") }),
|
|
29
|
+
restore: async () => ({ status: "error", error: new Error("No ProductProvider") }),
|
|
30
|
+
};
|
|
20
31
|
const OnboardingDataGate = ({ client, locale, customAudienceParams, setOnboarding, fontsFallback, children, }) => {
|
|
21
32
|
const { data, error } = (0, react_query_1.useQuery)((0, getOnboarding_query_1.getOnboardingQuery)(client, locale, customAudienceParams, setOnboarding));
|
|
22
33
|
// Background asset preload: once the payload is available, warm every remote
|
|
@@ -37,7 +48,7 @@ const OnboardingDataGate = ({ client, locale, customAudienceParams, setOnboardin
|
|
|
37
48
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fontsFallback !== null && fontsFallback !== void 0 ? fontsFallback : null });
|
|
38
49
|
return ((0, jsx_runtime_1.jsx)(FontLoader_1.FontLoaderGate, { fonts: data.fonts, fallback: fontsFallback, children: children }));
|
|
39
50
|
};
|
|
40
|
-
const OnboardingProvider = ({ children, client, locale = "en", customAudienceParams = {}, customActions = {}, fontsFallback, navigation = expoRouterAdapter_1.expoRouterAdapter, onComplete, }) => {
|
|
51
|
+
const OnboardingProvider = ({ children, client, locale = "en", customAudienceParams = {}, customActions = {}, fontsFallback, navigation = expoRouterAdapter_1.expoRouterAdapter, onComplete, productProvider, productRefs, }) => {
|
|
41
52
|
const [activeStep, setActiveStep] = (0, react_1.useState)({
|
|
42
53
|
number: 0,
|
|
43
54
|
displayProgressHeader: false,
|
|
@@ -75,6 +86,7 @@ const OnboardingProvider = ({ children, client, locale = "en", customAudiencePar
|
|
|
75
86
|
metadata: onboarding === null || onboarding === void 0 ? void 0 : onboarding.metadata,
|
|
76
87
|
});
|
|
77
88
|
}, [onComplete, onboarding]);
|
|
89
|
+
const productRuntime = (0, useProducts_1.useProducts)(productRefs, productProvider, locale);
|
|
78
90
|
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(exports.OnboardingProgressContext.Provider, { value: {
|
|
79
91
|
activeStep,
|
|
80
92
|
setActiveStep,
|
|
@@ -93,6 +105,7 @@ const OnboardingProvider = ({ children, client, locale = "en", customAudiencePar
|
|
|
93
105
|
completeOnboarding,
|
|
94
106
|
customActions,
|
|
95
107
|
navigation,
|
|
108
|
+
products: productRuntime,
|
|
96
109
|
}, children: (0, jsx_runtime_1.jsx)(OnboardingDataGate, { client: client, locale: locale, customAudienceParams: customAudienceParams, setOnboarding: setOnboarding, fontsFallback: fontsFallback, children: children }) }) }));
|
|
97
110
|
};
|
|
98
111
|
exports.OnboardingProvider = OnboardingProvider;
|
|
@@ -114,5 +127,6 @@ exports.OnboardingProgressContext = (0, react_1.createContext)({
|
|
|
114
127
|
completeOnboarding: () => { },
|
|
115
128
|
customActions: {},
|
|
116
129
|
navigation: expoRouterAdapter_1.expoRouterAdapter,
|
|
130
|
+
products: EMPTY_PRODUCT_RUNTIME,
|
|
117
131
|
});
|
|
118
132
|
//# sourceMappingURL=OnboardingProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnboardingProvider.js","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAAgF;AAChF,uDAAmF;AACnF,yEAAsE;AACtE,wEAAoE;AAIpE,6CAA8C;AAC9C,kEAA+D;AAC/D,4DAAyD;AAEzD,uEAAoE;
|
|
1
|
+
{"version":3,"file":"OnboardingProvider.js","sourceRoot":"","sources":["../../../src/infra/provider/OnboardingProvider.tsx"],"names":[],"mappings":";;;;AAAA,iCAAgF;AAChF,uDAAmF;AACnF,yEAAsE;AACtE,wEAAoE;AAIpE,6CAA8C;AAC9C,kEAA+D;AAC/D,4DAAyD;AAEzD,uEAAoE;AACpE,4DAAyD;AAGzD,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC;IAClC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC,CAAA;AAEF,0EAA0E;AAC1E,wEAAwE;AACxE,sEAAsE;AACtE,MAAM,qBAAqB,GAAmB;IAC5C,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;IACnF,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;CACnF,CAAC;AAoFF,MAAM,kBAAkB,GAAG,CAAC,EAC1B,MAAM,EACN,MAAM,EACN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EAAE,GAAG,CAAC;IACxB,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC;IAC1B,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,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,aAAa,EAAE,EAAE;IACjB,UAAU,EAAE,qCAAiB;IAC7B,QAAQ,EAAE,qBAAqB;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expoIap.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/expoIap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA8C,MAAM,UAAU,CAAC;AAyB5F,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,GAAI,MAAK,GAAS,KAAG,eAiEvD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expoIapProductProvider = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
// Optional peer: expo-iap. Same dynamic-require pattern as elements/haptics.ts.
|
|
6
|
+
let IAP;
|
|
7
|
+
try {
|
|
8
|
+
IAP = require("expo-iap");
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
IAP = null;
|
|
12
|
+
}
|
|
13
|
+
const toPeriod = (iso) => {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!iso)
|
|
16
|
+
return { period: null, count: 0 };
|
|
17
|
+
const m = /^P(\d+)([DWMY])$/.exec(iso);
|
|
18
|
+
if (!m)
|
|
19
|
+
return { period: null, count: 0 };
|
|
20
|
+
const map = { D: "week", W: "week", M: "month", Y: "year" };
|
|
21
|
+
return { period: (_a = map[m[2]]) !== null && _a !== void 0 ? _a : null, count: Number(m[1]) };
|
|
22
|
+
};
|
|
23
|
+
// expo-iap surfaces a user cancellation as a code rather than a typed error.
|
|
24
|
+
const isCancellation = (e) => (e === null || e === void 0 ? void 0 : e.code) === "E_USER_CANCELLED" || (e === null || e === void 0 ? void 0 : e.code) === "USER_CANCELED" || (e === null || e === void 0 ? void 0 : e.userCancelled) === true;
|
|
25
|
+
const idFor = (ref) => react_native_1.Platform.OS === "ios" ? ref.ios : ref.android;
|
|
26
|
+
/** Direct StoreKit / Play Billing provider, no vendor in the path. */
|
|
27
|
+
const expoIapProductProvider = (Iap = IAP) => {
|
|
28
|
+
const required = () => {
|
|
29
|
+
if (!Iap) {
|
|
30
|
+
throw new Error("expoIapProductProvider: expo-iap is not installed. Install it, or pass a different ProductProvider.");
|
|
31
|
+
}
|
|
32
|
+
return Iap;
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
async getProducts(refs) {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
37
|
+
const M = required();
|
|
38
|
+
const wanted = refs.map((r) => ({ ref: r, id: idFor(r) })).filter((x) => !!x.id);
|
|
39
|
+
if (wanted.length === 0)
|
|
40
|
+
return [];
|
|
41
|
+
const skus = wanted.map((w) => w.id);
|
|
42
|
+
const store = await M.getProducts(skus);
|
|
43
|
+
const byId = new Map(store.map((s) => { var _a; return [(_a = s.id) !== null && _a !== void 0 ? _a : s.productId, s]; }));
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const { ref, id } of wanted) {
|
|
46
|
+
const s = byId.get(id);
|
|
47
|
+
if (!s)
|
|
48
|
+
continue;
|
|
49
|
+
const iso = (_b = (_a = s.subscriptionPeriodISO) !== null && _a !== void 0 ? _a : s.subscriptionPeriod) !== null && _b !== void 0 ? _b : null;
|
|
50
|
+
const { period, count } = toPeriod(iso);
|
|
51
|
+
out.push({
|
|
52
|
+
key: ref.key,
|
|
53
|
+
productId: (_c = s.id) !== null && _c !== void 0 ? _c : s.productId,
|
|
54
|
+
store: react_native_1.Platform.OS === "ios" ? "app_store" : "play_store",
|
|
55
|
+
title: (_d = s.title) !== null && _d !== void 0 ? _d : "",
|
|
56
|
+
description: (_e = s.description) !== null && _e !== void 0 ? _e : "",
|
|
57
|
+
price: (_g = (_f = s.displayPrice) !== null && _f !== void 0 ? _f : s.localizedPrice) !== null && _g !== void 0 ? _g : "",
|
|
58
|
+
priceAmount: Number((_h = s.price) !== null && _h !== void 0 ? _h : 0),
|
|
59
|
+
currencyCode: (_k = (_j = s.currency) !== null && _j !== void 0 ? _j : s.currencyCode) !== null && _k !== void 0 ? _k : "",
|
|
60
|
+
period,
|
|
61
|
+
periodCount: count,
|
|
62
|
+
periodIso: iso,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
},
|
|
67
|
+
async purchase(product) {
|
|
68
|
+
const M = required();
|
|
69
|
+
try {
|
|
70
|
+
await M.requestPurchase({ request: { sku: product.productId } });
|
|
71
|
+
return { status: "purchased", productKey: product.key };
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
if (isCancellation(e))
|
|
75
|
+
return { status: "cancelled" };
|
|
76
|
+
return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
async restore() {
|
|
80
|
+
const M = required();
|
|
81
|
+
try {
|
|
82
|
+
const purchases = await M.getAvailablePurchases();
|
|
83
|
+
const ids = (purchases !== null && purchases !== void 0 ? purchases : []).map((p) => { var _a; return (_a = p.id) !== null && _a !== void 0 ? _a : p.productId; }).filter(Boolean);
|
|
84
|
+
return ids.length > 0
|
|
85
|
+
? { status: "restored", entitlements: ids }
|
|
86
|
+
: { status: "nothing_to_restore" };
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.expoIapProductProvider = expoIapProductProvider;
|
|
95
|
+
//# sourceMappingURL=expoIap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expoIap.js","sourceRoot":"","sources":["../../../src/products/adapters/expoIap.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAGxC,gFAAgF;AAChF,IAAI,GAAQ,CAAC;AACb,IAAI,CAAC;IACH,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAAC,WAAM,CAAC;IACP,GAAG,GAAG,IAAI,CAAC;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAmD,EAAE;;IACnG,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC5C,MAAM,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAkC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3F,OAAO,EAAE,MAAM,EAAE,MAAA,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAI,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5D,CAAC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,cAAc,GAAG,CAAC,CAAM,EA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oBAC3C,CAAC,CAAC,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;YACvC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,sBAAsB,0BAiEjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProductProvider } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* RevenueCat-backed provider. Pass the `Purchases` module explicitly if you have
|
|
4
|
+
* a custom instance; otherwise the installed one is used.
|
|
5
|
+
*/
|
|
6
|
+
export declare const revenueCatProductProvider: (Purchases?: any) => ProductProvider;
|
|
7
|
+
//# sourceMappingURL=revenueCat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revenueCat.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/revenueCat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA8C,MAAM,UAAU,CAAC;AA0B5F;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,YAAW,GAAuB,KAAG,eA4E9E,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.revenueCatProductProvider = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
// Optional peer: react-native-purchases. Same dynamic-require pattern as
|
|
6
|
+
// elements/haptics.ts — absent is not a crash, it is a clear error at call time.
|
|
7
|
+
let RC;
|
|
8
|
+
try {
|
|
9
|
+
RC = require("react-native-purchases");
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
RC = null;
|
|
13
|
+
}
|
|
14
|
+
const PERIOD_UNIT = {
|
|
15
|
+
DAY: "week", WEEK: "week", MONTH: "month", YEAR: "year",
|
|
16
|
+
};
|
|
17
|
+
const toPeriod = (iso) => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (!iso)
|
|
20
|
+
return { period: null, count: 0 };
|
|
21
|
+
const m = /^P(\d+)([DWMY])$/.exec(iso);
|
|
22
|
+
if (!m)
|
|
23
|
+
return { period: null, count: 0 };
|
|
24
|
+
const unit = { D: "DAY", W: "WEEK", M: "MONTH", Y: "YEAR" }[m[2]];
|
|
25
|
+
return { period: (_a = PERIOD_UNIT[unit]) !== null && _a !== void 0 ? _a : null, count: Number(m[1]) };
|
|
26
|
+
};
|
|
27
|
+
const idFor = (ref) => react_native_1.Platform.OS === "ios" ? ref.ios : ref.android;
|
|
28
|
+
/**
|
|
29
|
+
* RevenueCat-backed provider. Pass the `Purchases` module explicitly if you have
|
|
30
|
+
* a custom instance; otherwise the installed one is used.
|
|
31
|
+
*/
|
|
32
|
+
const revenueCatProductProvider = (Purchases) => {
|
|
33
|
+
var _a;
|
|
34
|
+
if (Purchases === void 0) { Purchases = (_a = RC === null || RC === void 0 ? void 0 : RC.default) !== null && _a !== void 0 ? _a : RC; }
|
|
35
|
+
const required = () => {
|
|
36
|
+
if (!Purchases) {
|
|
37
|
+
throw new Error("revenueCatProductProvider: react-native-purchases is not installed. Install it, or pass a different ProductProvider.");
|
|
38
|
+
}
|
|
39
|
+
return Purchases;
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
async getProducts(refs) {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
const P = required();
|
|
45
|
+
const wanted = refs.map((r) => ({ ref: r, id: idFor(r) })).filter((x) => !!x.id);
|
|
46
|
+
if (wanted.length === 0)
|
|
47
|
+
return [];
|
|
48
|
+
const store = await P.getProducts(wanted.map((w) => w.id));
|
|
49
|
+
const byId = new Map(store.map((s) => [s.identifier, s]));
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const { ref, id } of wanted) {
|
|
52
|
+
const s = byId.get(id);
|
|
53
|
+
if (!s)
|
|
54
|
+
continue;
|
|
55
|
+
const { period, count } = toPeriod(s.subscriptionPeriod);
|
|
56
|
+
out.push({
|
|
57
|
+
key: ref.key,
|
|
58
|
+
productId: s.identifier,
|
|
59
|
+
store: react_native_1.Platform.OS === "ios" ? "app_store" : "play_store",
|
|
60
|
+
title: (_a = s.title) !== null && _a !== void 0 ? _a : "",
|
|
61
|
+
description: (_b = s.description) !== null && _b !== void 0 ? _b : "",
|
|
62
|
+
price: s.priceString,
|
|
63
|
+
priceAmount: s.price,
|
|
64
|
+
currencyCode: s.currencyCode,
|
|
65
|
+
period,
|
|
66
|
+
periodCount: count,
|
|
67
|
+
periodIso: (_c = s.subscriptionPeriod) !== null && _c !== void 0 ? _c : null,
|
|
68
|
+
trial: s.introPrice && s.introPrice.price === 0
|
|
69
|
+
? {
|
|
70
|
+
period: (_d = toPeriod(s.introPrice.periodISO).period) !== null && _d !== void 0 ? _d : "week",
|
|
71
|
+
periodCount: toPeriod(s.introPrice.periodISO).count,
|
|
72
|
+
days: 0,
|
|
73
|
+
}
|
|
74
|
+
: undefined,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
},
|
|
79
|
+
async purchase(product) {
|
|
80
|
+
var _a, _b, _c;
|
|
81
|
+
const P = required();
|
|
82
|
+
try {
|
|
83
|
+
const store = await P.getProducts([product.productId]);
|
|
84
|
+
if (!store[0])
|
|
85
|
+
return { status: "error", error: new Error(`Unknown product ${product.productId}`) };
|
|
86
|
+
const res = await P.purchaseStoreProduct(store[0]);
|
|
87
|
+
return {
|
|
88
|
+
status: "purchased",
|
|
89
|
+
productKey: product.key,
|
|
90
|
+
entitlements: Object.keys((_c = (_b = (_a = res === null || res === void 0 ? void 0 : res.customerInfo) === null || _a === void 0 ? void 0 : _a.entitlements) === null || _b === void 0 ? void 0 : _b.active) !== null && _c !== void 0 ? _c : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
if (e === null || e === void 0 ? void 0 : e.userCancelled)
|
|
95
|
+
return { status: "cancelled" };
|
|
96
|
+
return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
async restore() {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
const P = required();
|
|
102
|
+
try {
|
|
103
|
+
const info = await P.restorePurchases();
|
|
104
|
+
const ents = Object.keys((_b = (_a = info === null || info === void 0 ? void 0 : info.entitlements) === null || _a === void 0 ? void 0 : _a.active) !== null && _b !== void 0 ? _b : {});
|
|
105
|
+
return ents.length > 0
|
|
106
|
+
? { status: "restored", entitlements: ents }
|
|
107
|
+
: { status: "nothing_to_restore" };
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
return { status: "error", error: e instanceof Error ? e : new Error(String(e)) };
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.revenueCatProductProvider = revenueCatProductProvider;
|
|
116
|
+
//# sourceMappingURL=revenueCat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revenueCat.js","sourceRoot":"","sources":["../../../src/products/adapters/revenueCat.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAGxC,yEAAyE;AACzE,iFAAiF;AACjF,IAAI,EAAO,CAAC;AACZ,IAAI,CAAC;IACH,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACzC,CAAC;AAAC,WAAM,CAAC;IACP,EAAE,GAAG,IAAI,CAAC;AACZ,CAAC;AAED,MAAM,WAAW,GAAkC;IACjD,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM;CACxD,CAAC;AAEF,MAAM,QAAQ,G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
import type { ProductProvider, ResolvedProduct } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* In-memory provider for demos, tests, and studio previews. NEVER ship a paywall
|
|
4
|
+
* backed by this — its prices are invented, and App Review rejects a paywall
|
|
5
|
+
* whose displayed price does not match the store.
|
|
6
|
+
*/
|
|
7
|
+
export declare const stubProductProvider: (catalog: Record<string, Omit<ResolvedProduct, "key">>) => ProductProvider;
|
|
8
|
+
//# sourceMappingURL=stub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../../src/products/adapters/stub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAc,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,KACpD,eAUD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stubProductProvider = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* In-memory provider for demos, tests, and studio previews. NEVER ship a paywall
|
|
6
|
+
* backed by this — its prices are invented, and App Review rejects a paywall
|
|
7
|
+
* whose displayed price does not match the store.
|
|
8
|
+
*/
|
|
9
|
+
const stubProductProvider = (catalog) => ({
|
|
10
|
+
async getProducts(refs) {
|
|
11
|
+
return refs.filter((r) => catalog[r.key]).map((r) => (Object.assign({ key: r.key }, catalog[r.key])));
|
|
12
|
+
},
|
|
13
|
+
async purchase(product) {
|
|
14
|
+
return { status: "purchased", productKey: product.key };
|
|
15
|
+
},
|
|
16
|
+
async restore() {
|
|
17
|
+
return { status: "nothing_to_restore" };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.stubProductProvider = stubProductProvider;
|
|
21
|
+
//# sourceMappingURL=stub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../../src/products/adapters/stub.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CACjC,OAAqD,EACpC,EAAE,CAAC,CAAC;IACrB,KAAK,CAAC,WAAW,CAAC,IAAkB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAG,GAAG,EAAE,CAAC,CAAC,GAAG,IAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC,CAAC;IAC5F,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAAO;QACpB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1D,CAAC;IACD,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IAC1C,CAAC;CACF,CAAC,CAAC;AAZU,QAAA,mBAAmB,uBAY7B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DerivedProductFields, ProductRef, ProductWithDerived, ResolvedProduct } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Format in the PRODUCT's currency, not the device's. Falls back to a plain
|
|
4
|
+
* `amount currencyCode` string if Intl rejects the code, so a bad code degrades
|
|
5
|
+
* to something readable instead of throwing mid-render.
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatCurrency: (amount: number, currencyCode: string, locale?: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Derived fields for one product. `compareTo` enables `savingsPct`, computed on
|
|
10
|
+
* a normalized per-day basis so a yearly plan can be compared to a monthly one.
|
|
11
|
+
* These are FRAMING values ("$1.15/week"), never presented as the charged amount.
|
|
12
|
+
*/
|
|
13
|
+
export declare const deriveProductFields: (p: ResolvedProduct, opts?: {
|
|
14
|
+
compareTo?: ResolvedProduct;
|
|
15
|
+
locale?: string;
|
|
16
|
+
}) => DerivedProductFields;
|
|
17
|
+
/** Derive every product, keyed by its ref key, resolving `compareTo` between them. */
|
|
18
|
+
export declare const deriveAll: (products: ResolvedProduct[], refs: ProductRef[], locale?: string) => Record<string, ProductWithDerived>;
|
|
19
|
+
//# sourceMappingURL=derive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/products/derive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,SAAS,MAAM,KACd,MASF,CAAC;AAQF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,GAAG,eAAe,EAClB,OAAM;IAAE,SAAS,CAAC,EAAE,eAAe,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,KAC1D,oBAiCF,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,SAAS,GACpB,UAAU,eAAe,EAAE,EAC3B,MAAM,UAAU,EAAE,EAClB,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAUnC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveAll = exports.deriveProductFields = exports.formatCurrency = void 0;
|
|
4
|
+
const duration_1 = require("./duration");
|
|
5
|
+
/**
|
|
6
|
+
* Format in the PRODUCT's currency, not the device's. Falls back to a plain
|
|
7
|
+
* `amount currencyCode` string if Intl rejects the code, so a bad code degrades
|
|
8
|
+
* to something readable instead of throwing mid-render.
|
|
9
|
+
*/
|
|
10
|
+
const formatCurrency = (amount, currencyCode, locale) => {
|
|
11
|
+
try {
|
|
12
|
+
return new Intl.NumberFormat(locale, {
|
|
13
|
+
style: "currency",
|
|
14
|
+
currency: currencyCode,
|
|
15
|
+
}).format(amount);
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return `${amount.toFixed(2)} ${currencyCode}`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.formatCurrency = formatCurrency;
|
|
22
|
+
const perDay = (p) => {
|
|
23
|
+
const days = (0, duration_1.parseIsoDuration)(p.periodIso);
|
|
24
|
+
if (!days || days <= 0)
|
|
25
|
+
return null;
|
|
26
|
+
return p.priceAmount / days;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Derived fields for one product. `compareTo` enables `savingsPct`, computed on
|
|
30
|
+
* a normalized per-day basis so a yearly plan can be compared to a monthly one.
|
|
31
|
+
* These are FRAMING values ("$1.15/week"), never presented as the charged amount.
|
|
32
|
+
*/
|
|
33
|
+
const deriveProductFields = (p, opts = {}) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const { compareTo, locale } = opts;
|
|
36
|
+
const out = {};
|
|
37
|
+
const daily = perDay(p);
|
|
38
|
+
if (daily != null) {
|
|
39
|
+
const week = daily * 7;
|
|
40
|
+
const month = daily * 30;
|
|
41
|
+
const year = daily * 365;
|
|
42
|
+
out.pricePerWeekAmount = week;
|
|
43
|
+
out.pricePerWeek = (0, exports.formatCurrency)(week, p.currencyCode, locale);
|
|
44
|
+
out.pricePerMonthAmount = month;
|
|
45
|
+
out.pricePerMonth = (0, exports.formatCurrency)(month, p.currencyCode, locale);
|
|
46
|
+
out.pricePerYearAmount = year;
|
|
47
|
+
out.pricePerYear = (0, exports.formatCurrency)(year, p.currencyCode, locale);
|
|
48
|
+
}
|
|
49
|
+
if (compareTo) {
|
|
50
|
+
const otherDaily = perDay(compareTo);
|
|
51
|
+
if (daily != null && otherDaily != null && otherDaily > 0 && daily < otherDaily) {
|
|
52
|
+
out.savingsPct = Math.round((1 - daily / otherDaily) * 100);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (p.trial) {
|
|
56
|
+
const days = p.trial.days > 0
|
|
57
|
+
? p.trial.days
|
|
58
|
+
: ((_a = (0, duration_1.parseIsoDuration)(`P${p.trial.periodCount}${p.trial.period === "week" ? "W" : p.trial.period === "month" ? "M" : p.trial.period === "year" ? "Y" : "D"}`)) !== null && _a !== void 0 ? _a : 0);
|
|
59
|
+
if (days > 0)
|
|
60
|
+
out.trialDays = days;
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
};
|
|
64
|
+
exports.deriveProductFields = deriveProductFields;
|
|
65
|
+
/** Derive every product, keyed by its ref key, resolving `compareTo` between them. */
|
|
66
|
+
const deriveAll = (products, refs, locale) => {
|
|
67
|
+
const byKey = new Map(products.map((p) => [p.key, p]));
|
|
68
|
+
const out = {};
|
|
69
|
+
for (const ref of refs) {
|
|
70
|
+
const p = byKey.get(ref.key);
|
|
71
|
+
if (!p)
|
|
72
|
+
continue;
|
|
73
|
+
const compareTo = ref.compareTo ? byKey.get(ref.compareTo) : undefined;
|
|
74
|
+
out[ref.key] = Object.assign(Object.assign({}, p), (0, exports.deriveProductFields)(p, { compareTo, locale }));
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
};
|
|
78
|
+
exports.deriveAll = deriveAll;
|
|
79
|
+
//# sourceMappingURL=derive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/products/derive.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAQ9C;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,YAAoB,EACpB,MAAe,EACP,EAAE;IACV,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YACnC,KA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AS,GAAG,CACvB,QAA2B,EAC3B,IAAkB,EAClB,MAAe,EACqB,EAAE;IACtC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,GAAG,GAAuC,EAAE,CAAC;IACnD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAQ,CAAC,GAAK,IAAA,2BAAmB,EAAC,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,SAAS,aAcpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/products/duration.ts"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,IAY1E,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseIsoDuration = void 0;
|
|
4
|
+
// Store-standard ISO-8601 subscription periods only: P1W / P1M / P3M / P1Y / P7D.
|
|
5
|
+
// Time components (PT1H) are not subscription periods and are rejected rather
|
|
6
|
+
// than silently coerced — a wrong period would corrupt every per-period price.
|
|
7
|
+
const ISO_PERIOD = /^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?$/;
|
|
8
|
+
const DAYS_PER = { year: 365, month: 30, week: 7, day: 1 };
|
|
9
|
+
/** ISO-8601 period → whole days. `null` when unparseable or empty (bare "P"). */
|
|
10
|
+
const parseIsoDuration = (iso) => {
|
|
11
|
+
if (!iso)
|
|
12
|
+
return null;
|
|
13
|
+
const m = ISO_PERIOD.exec(iso);
|
|
14
|
+
if (!m)
|
|
15
|
+
return null;
|
|
16
|
+
const [, y, mo, w, d] = m;
|
|
17
|
+
if (!y && !mo && !w && !d)
|
|
18
|
+
return null;
|
|
19
|
+
return (Number(y !== null && y !== void 0 ? y : 0) * DAYS_PER.year +
|
|
20
|
+
Number(mo !== null && mo !== void 0 ? mo : 0) * DAYS_PER.month +
|
|
21
|
+
Number(w !== null && w !== void 0 ? w : 0) * DAYS_PER.week +
|
|
22
|
+
Number(d !== null && d !== void 0 ? d : 0) * DAYS_PER.day);
|
|
23
|
+
};
|
|
24
|
+
exports.parseIsoDuration = parseIsoDuration;
|
|
25
|
+
//# sourceMappingURL=duration.js.map
|