@developer_tribe/react-builder 1.2.27 → 1.2.29

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.
Files changed (156) hide show
  1. package/dist/assets/samples/getSamples.d.ts +0 -3
  2. package/dist/build-components/BIcon/BIconProps.generated.d.ts +1 -2
  3. package/dist/build-components/CountDown/CountDownProps.generated.d.ts +2 -1
  4. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +1 -2
  5. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +1 -2
  6. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +1 -2
  7. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +1 -2
  8. package/dist/build-components/PaywallOptions/usePaywallOptionParamsFactory.d.ts +1 -1
  9. package/dist/build-components/PriceTag/PriceTag.d.ts +5 -0
  10. package/dist/build-components/PriceTag/PriceTagProps.generated.d.ts +63 -0
  11. package/dist/build-components/Pricing/Pricing.d.ts +5 -0
  12. package/dist/build-components/Pricing/PricingProps.generated.d.ts +59 -0
  13. package/dist/build-components/Promo/Promo.d.ts +5 -0
  14. package/dist/build-components/Promo/PromoProps.generated.d.ts +59 -0
  15. package/dist/build-components/Text/TextProps.generated.d.ts +1 -2
  16. package/dist/build-components/index.d.ts +4 -1
  17. package/dist/build-components/patterns.generated.d.ts +1405 -202
  18. package/dist/components/BuilderProvider.d.ts +5 -3
  19. package/dist/components/ParamsProvider.d.ts +16 -8
  20. package/dist/hooks/useSyncHtmlThemeClass.d.ts +1 -1
  21. package/dist/index.cjs.js +4 -4
  22. package/dist/index.cjs.js.map +1 -1
  23. package/dist/index.d.ts +16 -3
  24. package/dist/index.esm.js +4 -4
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/index.web.cjs.js +4 -4
  27. package/dist/index.web.cjs.js.map +1 -1
  28. package/dist/index.web.esm.js +4 -4
  29. package/dist/index.web.esm.js.map +1 -1
  30. package/dist/logger.d.ts +18 -0
  31. package/dist/modals/InspectModal.d.ts +5 -0
  32. package/dist/modals/index.d.ts +1 -1
  33. package/dist/pages/ProjectPage.d.ts +3 -3
  34. package/dist/paywall/hooks/useCalculateLocalizedPrice.d.ts +4 -2
  35. package/dist/paywall/hooks/useDiscountRate.d.ts +3 -2
  36. package/dist/paywall/types/paywall-types.d.ts +7 -32
  37. package/dist/product-base/buildPaywallLocalizationParams.d.ts +16 -0
  38. package/dist/product-base/calculations.d.ts +29 -0
  39. package/dist/product-base/extractAndroidParams.d.ts +24 -0
  40. package/dist/product-base/extractIOSParams.d.ts +24 -0
  41. package/dist/product-base/index.d.ts +51 -0
  42. package/dist/product-base/periodLocalizationKeys.d.ts +44 -0
  43. package/dist/product-base/types.d.ts +155 -0
  44. package/dist/product-base/usePaywallLocalizationParams.d.ts +29 -0
  45. package/dist/store.d.ts +7 -1
  46. package/dist/styles.css +1 -1
  47. package/dist/types/PreviewConfig.d.ts +10 -16
  48. package/dist/utils/extractTextStyle/extractTextStyle.d.ts +2 -2
  49. package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +2 -2
  50. package/dist/utils/replaceLocalizationParams.d.ts +1 -1
  51. package/package.json +2 -2
  52. package/scripts/migrate-samples-to-current.ts +3 -3
  53. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +28 -12
  54. package/src/DeviceMockFrame.tsx +15 -10
  55. package/src/assets/meta.json +1 -1
  56. package/src/assets/samples/carousel-sample.json +6 -5
  57. package/src/assets/samples/getSamples.ts +16 -49
  58. package/src/assets/samples/paywall-1.json +64 -22
  59. package/src/assets/samples/paywall-2.json +0 -15
  60. package/src/assets/samples/paywall-app-delete-offer.json +0 -15
  61. package/src/assets/samples/paywall-app-open-offer.json +0 -15
  62. package/src/assets/samples/paywall-back-offer.json +0 -15
  63. package/src/assets/samples/paywall-notification-offer.json +0 -15
  64. package/src/assets/samples/simple-1.json +1 -16
  65. package/src/assets/samples/simple-2.json +0 -15
  66. package/src/assets/samples/unmigrated-builder-1.1.1.json +0 -3
  67. package/src/assets/samples/unmigrated-builder1.json +0 -3
  68. package/src/assets/samples/unvalidated-builder1.json +0 -3
  69. package/src/assets/samples/unvalidated-crash1.json +0 -3
  70. package/src/assets/samples/unvalidated-crashcomponent1.json +0 -3
  71. package/src/assets/samples/vpn-onboard-1.json +1 -34
  72. package/src/assets/samples/vpn-onboard-2.json +1 -34
  73. package/src/assets/samples/vpn-onboard-3.json +1 -42
  74. package/src/assets/samples/vpn-onboard-4.json +0 -73
  75. package/src/assets/samples/vpn-onboard-5.json +0 -73
  76. package/src/assets/samples/vpn-onboard-6.json +0 -73
  77. package/src/assets/samples/vpn-onboard-7.json +529 -0
  78. package/src/attribute-analyser/style/native/useExtractImageStyle.ts +1 -4
  79. package/src/attribute-analyser/style/native/useExtractTextStyle.ts +3 -12
  80. package/src/attribute-analyser/style/native/useExtractViewStyle.ts +1 -4
  81. package/src/attribute-analyser/style/web/useExtractImageStyle.ts +1 -4
  82. package/src/attribute-analyser/style/web/useExtractTextStyle.ts +3 -12
  83. package/src/attribute-analyser/style/web/useExtractViewStyle.ts +1 -4
  84. package/src/attributes-editor/useAttributesEditorModel.ts +5 -52
  85. package/src/build-components/BIcon/BIconProps.generated.ts +1 -2
  86. package/src/build-components/CarouselDots/CarouselDots.tsx +6 -13
  87. package/src/build-components/CountDown/CountDownProps.generated.ts +2 -1
  88. package/src/build-components/NavigationBarColor/NavigationBarColor.tsx +2 -2
  89. package/src/build-components/OnboardButton/OnboardButton.tsx +1 -2
  90. package/src/build-components/OnboardDot/OnboardDot.tsx +6 -18
  91. package/src/build-components/OnboardFooter/OnboardFooter.tsx +5 -3
  92. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +1 -2
  93. package/src/build-components/OnboardFooter/pattern.json +1 -1
  94. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +1 -2
  95. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +1 -2
  96. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +1 -2
  97. package/src/build-components/PaywallOptions/PaywallOptions.tsx +3 -3
  98. package/src/build-components/PaywallOptions/usePaywallOptionParamsFactory.ts +26 -13
  99. package/src/build-components/PaywallProvider/PaywallProvider.tsx +51 -12
  100. package/src/build-components/PriceTag/PriceTag.tsx +25 -0
  101. package/src/build-components/PriceTag/PriceTagProps.generated.ts +83 -0
  102. package/src/build-components/PriceTag/pattern.json +53 -0
  103. package/src/build-components/Pricing/Pricing.tsx +13 -0
  104. package/src/build-components/Pricing/PricingProps.generated.ts +76 -0
  105. package/src/build-components/Pricing/pattern.json +25 -0
  106. package/src/build-components/Promo/Promo.tsx +13 -0
  107. package/src/build-components/Promo/PromoProps.generated.ts +76 -0
  108. package/src/build-components/Promo/pattern.json +25 -0
  109. package/src/build-components/RadioButton/RadioButton.tsx +3 -5
  110. package/src/build-components/RenderNode.generated.tsx +15 -0
  111. package/src/build-components/StatusBarColor/StatusBarColor.tsx +2 -2
  112. package/src/build-components/Text/Text.tsx +12 -5
  113. package/src/build-components/Text/TextProps.generated.ts +1 -2
  114. package/src/build-components/Text/pattern.json +3 -2
  115. package/src/build-components/index.ts +15 -0
  116. package/src/build-components/patterns.generated.ts +1454 -181
  117. package/src/components/BottomBar.tsx +42 -39
  118. package/src/components/BuilderProvider.tsx +41 -14
  119. package/src/components/LocalizationParamsProvider.tsx +1 -1
  120. package/src/components/ParamsProvider.tsx +36 -11
  121. package/src/hooks/useLocalize.ts +7 -4
  122. package/src/hooks/useParams.ts +1 -1
  123. package/src/hooks/useSyncHtmlThemeClass.ts +2 -2
  124. package/src/index.ts +54 -8
  125. package/src/logger.ts +39 -0
  126. package/src/modals/InspectModal.tsx +331 -0
  127. package/src/modals/ProductPresetsModal.tsx +7 -14
  128. package/src/modals/index.ts +1 -1
  129. package/src/pages/DebugJsonPage.tsx +9 -22
  130. package/src/pages/ProjectDebug.tsx +1 -1
  131. package/src/pages/ProjectPage.tsx +29 -11
  132. package/src/pages/tabs/SideTool.tsx +28 -104
  133. package/src/paywall/hooks/useCalculateLocalizedPrice.ts +8 -3
  134. package/src/paywall/hooks/useDiscountRate.ts +11 -3
  135. package/src/paywall/types/paywall-types.ts +7 -38
  136. package/src/product-base/buildPaywallLocalizationParams.ts +100 -0
  137. package/src/product-base/calculations.ts +93 -0
  138. package/src/product-base/extractAndroidParams.ts +207 -0
  139. package/src/product-base/extractIOSParams.ts +199 -0
  140. package/src/product-base/index.ts +64 -0
  141. package/src/product-base/mockProducts.json +489 -0
  142. package/src/product-base/periodLocalizationKeys.ts +114 -0
  143. package/src/product-base/types.ts +183 -0
  144. package/src/product-base/usePaywallLocalizationParams.ts +61 -0
  145. package/src/store.ts +18 -1
  146. package/src/styles/index.scss +1 -0
  147. package/src/styles/modals/_inspect-modal.scss +155 -0
  148. package/src/types/PreviewConfig.ts +157 -16
  149. package/src/utils/extractTextStyle/extractTextStyle.ts +14 -6
  150. package/src/utils/extractTextStyle/extractTextStyleNative.ts +8 -6
  151. package/src/utils/logRenderStore.ts +6 -10
  152. package/src/utils/parseColor.ts +0 -1
  153. package/src/utils/replaceLocalizationParams.ts +8 -4
  154. package/dist/modals/ScreenColorsModal.d.ts +0 -8
  155. package/src/assets/products.json +0 -98
  156. package/src/modals/ScreenColorsModal.tsx +0 -121
@@ -0,0 +1,489 @@
1
+ {
2
+ "preset-1": [
3
+ {
4
+ "productId": "com.app.monthly",
5
+ "id": "com.app.monthly",
6
+ "title": "Monthly",
7
+ "description": "Unlock all features for a month.",
8
+ "type": "subs",
9
+ "displayName": "Monthly Subscription",
10
+ "displayPrice": "$4.99",
11
+ "localizedPrice": "$4.99",
12
+ "currency": "USD",
13
+ "price": "4.99",
14
+ "platform": "android",
15
+ "subscriptionOffers": [
16
+ {
17
+ "id": "monthly-trial-offer",
18
+ "displayPrice": "Free → $4.99",
19
+ "price": 0,
20
+ "type": "promotional",
21
+ "currency": "USD",
22
+ "basePlanIdAndroid": "monthly-base",
23
+ "offerTokenAndroid": "mock_token_monthly_trial",
24
+ "pricingPhasesAndroid": {
25
+ "pricingPhaseList": [
26
+ {
27
+ "billingCycleCount": 1,
28
+ "billingPeriod": "P3D",
29
+ "formattedPrice": "Free",
30
+ "priceAmountMicros": "0",
31
+ "priceCurrencyCode": "USD",
32
+ "recurrenceMode": 3
33
+ },
34
+ {
35
+ "billingCycleCount": 0,
36
+ "billingPeriod": "P1M",
37
+ "formattedPrice": "$4.99",
38
+ "priceAmountMicros": "4990000",
39
+ "priceCurrencyCode": "USD",
40
+ "recurrenceMode": 1
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ ],
46
+ "introductoryPrice": {
47
+ "price": "0.00",
48
+ "priceIOS": "0.00",
49
+ "type": "free_trial",
50
+ "numberOfPeriods": 3,
51
+ "subscriptionPeriod": "DAY",
52
+ "subscriptionPeriodUnitIOS": "DAY",
53
+ "subscriptionPeriodNumberIOS": 3
54
+ },
55
+ "subscriptionPeriodUnitIOS": "MONTH",
56
+ "subscriptionPeriodNumberIOS": 1
57
+ },
58
+ {
59
+ "productId": "com.app.yearly",
60
+ "id": "com.app.yearly",
61
+ "title": "Yearly (Save 33%)",
62
+ "description": "Best value: full access for a year.",
63
+ "type": "subs",
64
+ "displayName": "Yearly Subscription",
65
+ "displayPrice": "$29.99",
66
+ "localizedPrice": "$29.99",
67
+ "currency": "USD",
68
+ "price": "29.99",
69
+ "platform": "android",
70
+ "subscriptionOffers": [
71
+ {
72
+ "id": "yearly-promo-offer",
73
+ "displayPrice": "$19.99",
74
+ "price": 19.99,
75
+ "type": "promotional",
76
+ "currency": "USD",
77
+ "basePlanIdAndroid": "yearly-base",
78
+ "offerTokenAndroid": "mock_token_yearly_promo",
79
+ "pricingPhasesAndroid": {
80
+ "pricingPhaseList": [
81
+ {
82
+ "billingCycleCount": 1,
83
+ "billingPeriod": "P1Y",
84
+ "formattedPrice": "$19.99",
85
+ "priceAmountMicros": "19990000",
86
+ "priceCurrencyCode": "USD",
87
+ "recurrenceMode": 2
88
+ },
89
+ {
90
+ "billingCycleCount": 0,
91
+ "billingPeriod": "P1Y",
92
+ "formattedPrice": "$29.99",
93
+ "priceAmountMicros": "29990000",
94
+ "priceCurrencyCode": "USD",
95
+ "recurrenceMode": 1
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ],
101
+ "introductoryPrice": {
102
+ "price": "19.99",
103
+ "priceIOS": "19.99",
104
+ "type": "pay_as_you_go",
105
+ "numberOfPeriods": 1,
106
+ "subscriptionPeriod": "YEAR",
107
+ "subscriptionPeriodUnitIOS": "YEAR",
108
+ "subscriptionPeriodNumberIOS": 1
109
+ },
110
+ "discounts": [
111
+ {
112
+ "identifier": "yearly-promo-offer",
113
+ "price": "19.99",
114
+ "numberOfPeriods": 1,
115
+ "subscriptionPeriod": "YEAR"
116
+ }
117
+ ],
118
+ "subscriptionPeriodUnitIOS": "YEAR",
119
+ "subscriptionPeriodNumberIOS": 1
120
+ },
121
+ {
122
+ "productId": "com.app.weekly",
123
+ "id": "com.app.weekly",
124
+ "title": "Weekly",
125
+ "description": "Try with a flexible weekly plan.",
126
+ "type": "subs",
127
+ "displayName": "Weekly Subscription",
128
+ "displayPrice": "$1.99",
129
+ "localizedPrice": "$1.99",
130
+ "currency": "USD",
131
+ "price": "1.99",
132
+ "platform": "android",
133
+ "subscriptionOffers": [
134
+ {
135
+ "id": "weekly-base",
136
+ "displayPrice": "$0.99",
137
+ "price": 0.99,
138
+ "type": "promotional",
139
+ "currency": "USD",
140
+ "basePlanIdAndroid": "weekly-base",
141
+ "offerTokenAndroid": "mock_token_weekly_promo",
142
+ "pricingPhasesAndroid": {
143
+ "pricingPhaseList": [
144
+ {
145
+ "billingCycleCount": 4,
146
+ "billingPeriod": "P1W",
147
+ "formattedPrice": "$0.99",
148
+ "priceAmountMicros": "990000",
149
+ "priceCurrencyCode": "USD",
150
+ "recurrenceMode": 2
151
+ },
152
+ {
153
+ "billingCycleCount": 0,
154
+ "billingPeriod": "P1W",
155
+ "formattedPrice": "$1.99",
156
+ "priceAmountMicros": "1990000",
157
+ "priceCurrencyCode": "USD",
158
+ "recurrenceMode": 1
159
+ }
160
+ ]
161
+ }
162
+ }
163
+ ],
164
+ "introductoryPrice": {
165
+ "price": "0.99",
166
+ "priceIOS": "0.99",
167
+ "type": "pay_as_you_go",
168
+ "numberOfPeriods": 4,
169
+ "subscriptionPeriod": "WEEK",
170
+ "subscriptionPeriodUnitIOS": "WEEK",
171
+ "subscriptionPeriodNumberIOS": 1
172
+ },
173
+ "subscriptionPeriodUnitIOS": "WEEK",
174
+ "subscriptionPeriodNumberIOS": 1
175
+ }
176
+ ],
177
+ "preset-2": [
178
+ {
179
+ "productId": "com.app.premium.monthly",
180
+ "id": "com.app.premium.monthly",
181
+ "title": "Premium Monthly",
182
+ "description": "Premium tier with all features.",
183
+ "type": "subs",
184
+ "displayName": "Premium Monthly",
185
+ "displayPrice": "$9.99",
186
+ "localizedPrice": "$9.99",
187
+ "currency": "USD",
188
+ "price": "9.99",
189
+ "platform": "android",
190
+ "subscriptionOffers": [
191
+ {
192
+ "id": "premium-monthly-trial-offer",
193
+ "displayPrice": "Free → $9.99",
194
+ "price": 0,
195
+ "type": "promotional",
196
+ "currency": "USD",
197
+ "basePlanIdAndroid": "premium-monthly-base",
198
+ "offerTokenAndroid": "mock_token_premium_monthly_trial",
199
+ "pricingPhasesAndroid": {
200
+ "pricingPhaseList": [
201
+ {
202
+ "billingCycleCount": 1,
203
+ "billingPeriod": "P7D",
204
+ "formattedPrice": "Free",
205
+ "priceAmountMicros": "0",
206
+ "priceCurrencyCode": "USD",
207
+ "recurrenceMode": 3
208
+ },
209
+ {
210
+ "billingCycleCount": 0,
211
+ "billingPeriod": "P1M",
212
+ "formattedPrice": "$9.99",
213
+ "priceAmountMicros": "9990000",
214
+ "priceCurrencyCode": "USD",
215
+ "recurrenceMode": 1
216
+ }
217
+ ]
218
+ }
219
+ }
220
+ ],
221
+ "introductoryPrice": {
222
+ "price": "0.00",
223
+ "priceIOS": "0.00",
224
+ "type": "free_trial",
225
+ "numberOfPeriods": 7,
226
+ "subscriptionPeriod": "DAY",
227
+ "subscriptionPeriodUnitIOS": "DAY",
228
+ "subscriptionPeriodNumberIOS": 7
229
+ },
230
+ "subscriptionPeriodUnitIOS": "MONTH",
231
+ "subscriptionPeriodNumberIOS": 1
232
+ },
233
+ {
234
+ "productId": "com.app.premium.yearly",
235
+ "id": "com.app.premium.yearly",
236
+ "title": "Premium Yearly (Save 50%)",
237
+ "description": "7-day free trial, then $29.99 first year, $59.99/yr after.",
238
+ "type": "subs",
239
+ "displayName": "Premium Yearly",
240
+ "displayPrice": "$59.99",
241
+ "localizedPrice": "$59.99",
242
+ "currency": "USD",
243
+ "price": "59.99",
244
+ "platform": "android",
245
+ "subscriptionOffers": [
246
+ {
247
+ "id": "premium-yearly-full-offer",
248
+ "displayPrice": "$29.99",
249
+ "price": 29.99,
250
+ "type": "promotional",
251
+ "currency": "USD",
252
+ "basePlanIdAndroid": "premium-yearly-base",
253
+ "offerTokenAndroid": "mock_token_premium_yearly_promo",
254
+ "pricingPhasesAndroid": {
255
+ "pricingPhaseList": [
256
+ {
257
+ "billingCycleCount": 1,
258
+ "billingPeriod": "P7D",
259
+ "formattedPrice": "Free",
260
+ "priceAmountMicros": "0",
261
+ "priceCurrencyCode": "USD",
262
+ "recurrenceMode": 3
263
+ },
264
+ {
265
+ "billingCycleCount": 1,
266
+ "billingPeriod": "P1Y",
267
+ "formattedPrice": "$29.99",
268
+ "priceAmountMicros": "29990000",
269
+ "priceCurrencyCode": "USD",
270
+ "recurrenceMode": 2
271
+ },
272
+ {
273
+ "billingCycleCount": 0,
274
+ "billingPeriod": "P1Y",
275
+ "formattedPrice": "$59.99",
276
+ "priceAmountMicros": "59990000",
277
+ "priceCurrencyCode": "USD",
278
+ "recurrenceMode": 1
279
+ }
280
+ ]
281
+ }
282
+ }
283
+ ],
284
+ "introductoryPrice": {
285
+ "price": "0.00",
286
+ "priceIOS": "0.00",
287
+ "type": "free_trial",
288
+ "numberOfPeriods": 7,
289
+ "subscriptionPeriod": "DAY",
290
+ "subscriptionPeriodUnitIOS": "DAY",
291
+ "subscriptionPeriodNumberIOS": 7
292
+ },
293
+ "discounts": [
294
+ {
295
+ "identifier": "premium-yearly-full-offer",
296
+ "price": "29.99",
297
+ "numberOfPeriods": 1,
298
+ "subscriptionPeriod": "YEAR"
299
+ }
300
+ ],
301
+ "subscriptionPeriodUnitIOS": "YEAR",
302
+ "subscriptionPeriodNumberIOS": 1
303
+ },
304
+ {
305
+ "productId": "com.app.lifetime",
306
+ "id": "com.app.lifetime",
307
+ "title": "Lifetime",
308
+ "description": "One-time purchase for lifetime access.",
309
+ "type": "in-app",
310
+ "displayName": "Lifetime Access",
311
+ "displayPrice": "$99.99",
312
+ "localizedPrice": "$99.99",
313
+ "currency": "USD",
314
+ "price": "99.99",
315
+ "platform": "android",
316
+ "subscriptionOffers": []
317
+ }
318
+ ],
319
+ "preset-3": [
320
+ {
321
+ "productId": "com.app.budget.weekly",
322
+ "id": "com.app.budget.weekly",
323
+ "title": "Budget Weekly",
324
+ "description": "Affordable weekly plan.",
325
+ "type": "subs",
326
+ "displayName": "Budget Weekly",
327
+ "displayPrice": "€2.99",
328
+ "localizedPrice": "€2.99",
329
+ "currency": "EUR",
330
+ "price": "2.99",
331
+ "currencyCode": "EUR",
332
+ "platform": "android",
333
+ "subscriptionOffers": [
334
+ {
335
+ "id": "budget-weekly-trial-offer",
336
+ "displayPrice": "Free → €2.99",
337
+ "price": 0,
338
+ "type": "promotional",
339
+ "currency": "EUR",
340
+ "basePlanIdAndroid": "budget-weekly-base",
341
+ "offerTokenAndroid": "mock_token_budget_weekly_trial",
342
+ "pricingPhasesAndroid": {
343
+ "pricingPhaseList": [
344
+ {
345
+ "billingCycleCount": 1,
346
+ "billingPeriod": "P3D",
347
+ "formattedPrice": "Free",
348
+ "priceAmountMicros": "0",
349
+ "priceCurrencyCode": "EUR",
350
+ "recurrenceMode": 3
351
+ },
352
+ {
353
+ "billingCycleCount": 0,
354
+ "billingPeriod": "P1W",
355
+ "formattedPrice": "€2.99",
356
+ "priceAmountMicros": "2990000",
357
+ "priceCurrencyCode": "EUR",
358
+ "recurrenceMode": 1
359
+ }
360
+ ]
361
+ }
362
+ }
363
+ ],
364
+ "introductoryPrice": {
365
+ "price": "0.00",
366
+ "priceIOS": "0.00",
367
+ "type": "free_trial",
368
+ "numberOfPeriods": 3,
369
+ "subscriptionPeriod": "DAY",
370
+ "subscriptionPeriodUnitIOS": "DAY",
371
+ "subscriptionPeriodNumberIOS": 3
372
+ },
373
+ "subscriptionPeriodUnitIOS": "WEEK",
374
+ "subscriptionPeriodNumberIOS": 1
375
+ },
376
+ {
377
+ "productId": "com.app.monthly.promo",
378
+ "id": "com.app.monthly.promo",
379
+ "title": "Monthly (70% off first 3 months)",
380
+ "description": "€2.99/mo for 3 months, then €9.99/mo.",
381
+ "type": "subs",
382
+ "displayName": "Monthly with Promo",
383
+ "displayPrice": "€9.99",
384
+ "localizedPrice": "€9.99",
385
+ "currency": "EUR",
386
+ "price": "9.99",
387
+ "currencyCode": "EUR",
388
+ "platform": "android",
389
+ "subscriptionOffers": [
390
+ {
391
+ "id": "monthly-promo-offer",
392
+ "displayPrice": "€2.99",
393
+ "price": 2.99,
394
+ "type": "promotional",
395
+ "currency": "EUR",
396
+ "basePlanIdAndroid": "monthly-promo",
397
+ "offerTokenAndroid": "mock_token_monthly_promo",
398
+ "pricingPhasesAndroid": {
399
+ "pricingPhaseList": [
400
+ {
401
+ "billingCycleCount": 3,
402
+ "billingPeriod": "P1M",
403
+ "formattedPrice": "€2.99",
404
+ "priceAmountMicros": "2990000",
405
+ "priceCurrencyCode": "EUR",
406
+ "recurrenceMode": 2
407
+ },
408
+ {
409
+ "billingCycleCount": 0,
410
+ "billingPeriod": "P1M",
411
+ "formattedPrice": "€9.99",
412
+ "priceAmountMicros": "9990000",
413
+ "priceCurrencyCode": "EUR",
414
+ "recurrenceMode": 1
415
+ }
416
+ ]
417
+ }
418
+ }
419
+ ],
420
+ "introductoryPrice": {
421
+ "price": "2.99",
422
+ "priceIOS": "2.99",
423
+ "type": "pay_as_you_go",
424
+ "numberOfPeriods": 3,
425
+ "subscriptionPeriod": "MONTH",
426
+ "subscriptionPeriodUnitIOS": "MONTH",
427
+ "subscriptionPeriodNumberIOS": 1
428
+ },
429
+ "subscriptionPeriodUnitIOS": "MONTH",
430
+ "subscriptionPeriodNumberIOS": 1
431
+ },
432
+ {
433
+ "productId": "com.app.yearly.trial",
434
+ "id": "com.app.yearly.trial",
435
+ "title": "Yearly (14-day free trial)",
436
+ "description": "Try free for 14 days, then €29.99/yr.",
437
+ "type": "subs",
438
+ "displayName": "Yearly with Trial",
439
+ "displayPrice": "€29.99",
440
+ "localizedPrice": "€29.99",
441
+ "currency": "EUR",
442
+ "price": "29.99",
443
+ "currencyCode": "EUR",
444
+ "platform": "android",
445
+ "subscriptionOffers": [
446
+ {
447
+ "id": "yearly-trial-offer",
448
+ "displayPrice": "Free → €29.99",
449
+ "price": 0,
450
+ "type": "promotional",
451
+ "currency": "EUR",
452
+ "basePlanIdAndroid": "yearly-trial",
453
+ "offerTokenAndroid": "mock_token_yearly_trial",
454
+ "pricingPhasesAndroid": {
455
+ "pricingPhaseList": [
456
+ {
457
+ "billingCycleCount": 1,
458
+ "billingPeriod": "P14D",
459
+ "formattedPrice": "Free",
460
+ "priceAmountMicros": "0",
461
+ "priceCurrencyCode": "EUR",
462
+ "recurrenceMode": 3
463
+ },
464
+ {
465
+ "billingCycleCount": 0,
466
+ "billingPeriod": "P1Y",
467
+ "formattedPrice": "€29.99",
468
+ "priceAmountMicros": "29990000",
469
+ "priceCurrencyCode": "EUR",
470
+ "recurrenceMode": 1
471
+ }
472
+ ]
473
+ }
474
+ }
475
+ ],
476
+ "introductoryPrice": {
477
+ "price": "0.00",
478
+ "priceIOS": "0.00",
479
+ "type": "free_trial",
480
+ "numberOfPeriods": 14,
481
+ "subscriptionPeriod": "DAY",
482
+ "subscriptionPeriodUnitIOS": "DAY",
483
+ "subscriptionPeriodNumberIOS": 14
484
+ },
485
+ "subscriptionPeriodUnitIOS": "YEAR",
486
+ "subscriptionPeriodNumberIOS": 1
487
+ }
488
+ ]
489
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Period localization key'leri ve utility fonksiyonları
3
+ * Backend'den gelen localization key'leri ile çeviri yapılır
4
+ */
5
+
6
+ /**
7
+ * Period localization key'leri
8
+ * Backend'de bu key'ler tanımlı olmalı
9
+ */
10
+ export const PERIOD_LOCALIZATION_KEYS = {
11
+ monthly: 'base.builder.paywall.period.monthly',
12
+ annual: 'base.builder.paywall.period.annual',
13
+ weekly: 'base.builder.paywall.period.weekly',
14
+ daily: 'base.builder.paywall.period.daily',
15
+ monthlyPromo: 'base.builder.paywall.period.monthlyPromo',
16
+ annualPromo: 'base.builder.paywall.period.annualPromo',
17
+ } as const;
18
+
19
+ export const PAYWALL_TEXT_KEYS = {
20
+ pricingDefault: 'base.builder.paywall.pricing.default.text',
21
+ pricingFreeTrial: 'base.builder.paywall.pricing.freeTrial.text',
22
+ pricingRegular: 'base.builder.paywall.pricing.regular.text',
23
+ promoDefault: 'base.builder.paywall.promo.default.text',
24
+ promoFreeTrial: 'base.builder.paywall.promo.freeTrial.text',
25
+ promoRegular: 'base.builder.paywall.promo.regular.text',
26
+ } as const;
27
+
28
+ /**
29
+ * Period ve promo durumuna göre doğru localization key'i seçer
30
+ */
31
+ export function getPeriodLocalizationKey(
32
+ period: 'day' | 'week' | 'month' | 'year',
33
+ hasPromo: boolean,
34
+ ): string {
35
+ switch (period) {
36
+ case 'month':
37
+ return hasPromo
38
+ ? PERIOD_LOCALIZATION_KEYS.monthlyPromo
39
+ : PERIOD_LOCALIZATION_KEYS.monthly;
40
+
41
+ case 'year':
42
+ return hasPromo
43
+ ? PERIOD_LOCALIZATION_KEYS.annualPromo
44
+ : PERIOD_LOCALIZATION_KEYS.annual;
45
+
46
+ case 'week':
47
+ return PERIOD_LOCALIZATION_KEYS.weekly;
48
+
49
+ case 'day':
50
+ return PERIOD_LOCALIZATION_KEYS.daily;
51
+
52
+ default:
53
+ return PERIOD_LOCALIZATION_KEYS.monthly;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * ISO 8601 billing period'u parse eder
59
+ * @example "P1M" → { value: 1, unit: "month" }
60
+ * @example "P7D" → { value: 7, unit: "day" }
61
+ * @example "P1Y" → { value: 1, unit: "year" }
62
+ */
63
+ export function parseBillingPeriod(iso8601: string): {
64
+ value: number;
65
+ unit: 'day' | 'week' | 'month' | 'year';
66
+ } {
67
+ const match = iso8601.match(/P(\d+)([DWMY])/);
68
+ if (!match || !match[1] || !match[2]) {
69
+ return { value: 1, unit: 'month' };
70
+ }
71
+
72
+ const value = parseInt(match[1], 10);
73
+ const unitCode = match[2];
74
+
75
+ const unitMap: Record<string, 'day' | 'week' | 'month' | 'year'> = {
76
+ D: 'day',
77
+ W: 'week',
78
+ M: 'month',
79
+ Y: 'year',
80
+ };
81
+
82
+ const unit = unitMap[unitCode];
83
+ if (!unit) {
84
+ return { value: 1, unit: 'month' };
85
+ }
86
+
87
+ return {
88
+ value,
89
+ unit,
90
+ };
91
+ }
92
+
93
+ /**
94
+ * iOS period unit'ini normalize eder
95
+ * @example "DAY" → "day"
96
+ * @example "MONTH" → "month"
97
+ */
98
+ export function convertIOSPeriodUnit(
99
+ iosUnit?: string,
100
+ ): 'day' | 'week' | 'month' | 'year' {
101
+ if (!iosUnit) {
102
+ return 'month';
103
+ }
104
+
105
+ const unitMap: Record<string, 'day' | 'week' | 'month' | 'year'> = {
106
+ DAY: 'day',
107
+ WEEK: 'week',
108
+ MONTH: 'month',
109
+ YEAR: 'year',
110
+ };
111
+
112
+ const normalized = unitMap[iosUnit.toUpperCase()];
113
+ return normalized || 'month';
114
+ }