@snap/camera-kit 0.22.0 → 1.0.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.
Files changed (575) hide show
  1. package/LICENSE.md +1122 -537
  2. package/README.md +1 -1
  3. package/dist/CameraKit.d.ts +3 -3
  4. package/dist/CameraKit.d.ts.map +1 -1
  5. package/dist/CameraKit.js +1 -2
  6. package/dist/CameraKit.js.map +1 -1
  7. package/dist/RootServices.d.ts +78 -0
  8. package/dist/RootServices.d.ts.map +1 -0
  9. package/dist/RootServices.js.map +1 -0
  10. package/dist/bootstrapCameraKit.d.ts +3 -4
  11. package/dist/bootstrapCameraKit.d.ts.map +1 -1
  12. package/dist/bootstrapCameraKit.js +8 -8
  13. package/dist/bootstrapCameraKit.js.map +1 -1
  14. package/dist/clients/createTsProtoClient.d.ts +2 -2
  15. package/dist/clients/createTsProtoClient.d.ts.map +1 -1
  16. package/dist/clients/createTsProtoClient.js.map +1 -1
  17. package/dist/clients/grpcHandler.d.ts.map +1 -1
  18. package/dist/clients/grpcHandler.js +1 -1
  19. package/dist/clients/grpcHandler.js.map +1 -1
  20. package/dist/clients/lensesClient.js +1 -1
  21. package/dist/clients/lensesClient.js.map +1 -1
  22. package/dist/clients/metricsClient.d.ts.map +1 -1
  23. package/dist/clients/metricsClient.js +1 -1
  24. package/dist/clients/metricsClient.js.map +1 -1
  25. package/dist/common/pageVisibility.js +1 -1
  26. package/dist/common/pageVisibility.js.map +1 -1
  27. package/dist/configuration.d.ts.map +1 -1
  28. package/dist/configuration.js +1 -1
  29. package/dist/configuration.js.map +1 -1
  30. package/dist/environment.d.ts.map +1 -1
  31. package/dist/environment.js +1 -1
  32. package/dist/environment.js.map +1 -1
  33. package/dist/extensions/RemoteApiServices.js +1 -1
  34. package/dist/extensions/RemoteApiServices.js.map +1 -1
  35. package/dist/extensions/UriHandlers.js +1 -1
  36. package/dist/extensions/UriHandlers.js.map +1 -1
  37. package/dist/extensions/uriHandlersRegister.d.ts.map +1 -1
  38. package/dist/extensions/uriHandlersRegister.js +1 -1
  39. package/dist/extensions/uriHandlersRegister.js.map +1 -1
  40. package/dist/generated-proto/blizzard/cameraKitEvents.d.ts +45 -9270
  41. package/dist/generated-proto/blizzard/cameraKitEvents.d.ts.map +1 -1
  42. package/dist/generated-proto/blizzard/cameraKitEvents.js +300 -123
  43. package/dist/generated-proto/blizzard/cameraKitEvents.js.map +1 -1
  44. package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +12 -32
  45. package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts.map +1 -1
  46. package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.js +77 -37
  47. package/dist/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
  48. package/dist/generated-proto/pb_schema/camera_kit/v3/export.d.ts +19 -454
  49. package/dist/generated-proto/pb_schema/camera_kit/v3/export.d.ts.map +1 -1
  50. package/dist/generated-proto/pb_schema/camera_kit/v3/export.js +219 -118
  51. package/dist/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -1
  52. package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.d.ts +12 -12
  53. package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.d.ts.map +1 -1
  54. package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.js +16 -13
  55. package/dist/generated-proto/pb_schema/camera_kit/v3/features/ranking_info.js.map +1 -1
  56. package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.d.ts +12 -12
  57. package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.d.ts.map +1 -1
  58. package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.js +16 -13
  59. package/dist/generated-proto/pb_schema/camera_kit/v3/features/remote_api_info.js.map +1 -1
  60. package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +13 -54
  61. package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts.map +1 -1
  62. package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +61 -34
  63. package/dist/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -1
  64. package/dist/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +19 -299
  65. package/dist/generated-proto/pb_schema/camera_kit/v3/lens.d.ts.map +1 -1
  66. package/dist/generated-proto/pb_schema/camera_kit/v3/lens.js +294 -133
  67. package/dist/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
  68. package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +14 -148
  69. package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts.map +1 -1
  70. package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +74 -48
  71. package/dist/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -1
  72. package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +12 -18
  73. package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts.map +1 -1
  74. package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.js +34 -19
  75. package/dist/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -1
  76. package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.d.ts +19 -516
  77. package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.d.ts.map +1 -1
  78. package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.js +164 -80
  79. package/dist/generated-proto/pb_schema/camera_kit/v3/remote_api_spec.js.map +1 -1
  80. package/dist/generated-proto/pb_schema/camera_kit/v3/service.d.ts +80 -2371
  81. package/dist/generated-proto/pb_schema/camera_kit/v3/service.d.ts.map +1 -1
  82. package/dist/generated-proto/pb_schema/camera_kit/v3/service.js +847 -174
  83. package/dist/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
  84. package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.d.ts.map +1 -1
  85. package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.js +0 -6
  86. package/dist/generated-proto/pb_schema/cdp/cof/app_launch_type.js.map +1 -1
  87. package/dist/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +18 -59
  88. package/dist/generated-proto/pb_schema/cdp/cof/benchmark.d.ts.map +1 -1
  89. package/dist/generated-proto/pb_schema/cdp/cof/benchmark.js +88 -52
  90. package/dist/generated-proto/pb_schema/cdp/cof/benchmark.js.map +1 -1
  91. package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.d.ts.map +1 -1
  92. package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.js +0 -6
  93. package/dist/generated-proto/pb_schema/cdp/cof/benchmark_name.js.map +1 -1
  94. package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.d.ts +12 -106
  95. package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.d.ts.map +1 -1
  96. package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.js +328 -140
  97. package/dist/generated-proto/pb_schema/cdp/cof/billboard_provided_signals.js.map +1 -1
  98. package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.d.ts +12 -18
  99. package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.d.ts.map +1 -1
  100. package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.js +35 -20
  101. package/dist/generated-proto/pb_schema/cdp/cof/bolt_provided_signals.js.map +1 -1
  102. package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.d.ts +12 -34
  103. package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.d.ts.map +1 -1
  104. package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.js +86 -39
  105. package/dist/generated-proto/pb_schema/cdp/cof/camera_provided_signals.js.map +1 -1
  106. package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +47 -28591
  107. package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts.map +1 -1
  108. package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.js +644 -348
  109. package/dist/generated-proto/pb_schema/cdp/cof/circumstance_service.js.map +1 -1
  110. package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.d.ts +12 -12
  111. package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.d.ts.map +1 -1
  112. package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.js +16 -13
  113. package/dist/generated-proto/pb_schema/cdp/cof/cognac_provided_signals.js.map +1 -1
  114. package/dist/generated-proto/pb_schema/cdp/cof/config_request.d.ts +18 -214
  115. package/dist/generated-proto/pb_schema/cdp/cof/config_request.d.ts.map +1 -1
  116. package/dist/generated-proto/pb_schema/cdp/cof/config_request.js +362 -157
  117. package/dist/generated-proto/pb_schema/cdp/cof/config_request.js.map +1 -1
  118. package/dist/generated-proto/pb_schema/cdp/cof/config_response.d.ts +20 -3801
  119. package/dist/generated-proto/pb_schema/cdp/cof/config_response.d.ts.map +1 -1
  120. package/dist/generated-proto/pb_schema/cdp/cof/config_response.js +144 -46
  121. package/dist/generated-proto/pb_schema/cdp/cof/config_response.js.map +1 -1
  122. package/dist/generated-proto/pb_schema/cdp/cof/config_result.d.ts +49 -10060
  123. package/dist/generated-proto/pb_schema/cdp/cof/config_result.d.ts.map +1 -1
  124. package/dist/generated-proto/pb_schema/cdp/cof/config_result.js +443 -182
  125. package/dist/generated-proto/pb_schema/cdp/cof/config_result.js.map +1 -1
  126. package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.d.ts.map +1 -1
  127. package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.js +0 -6
  128. package/dist/generated-proto/pb_schema/cdp/cof/contact_authorization_status.js.map +1 -1
  129. package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.d.ts +12 -12
  130. package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.d.ts.map +1 -1
  131. package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.js +16 -13
  132. package/dist/generated-proto/pb_schema/cdp/cof/content_manager_provided_signals.js.map +1 -1
  133. package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.d.ts +12 -14
  134. package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.d.ts.map +1 -1
  135. package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.js +24 -17
  136. package/dist/generated-proto/pb_schema/cdp/cof/creative_tools_provided_signals.js.map +1 -1
  137. package/dist/generated-proto/pb_schema/cdp/cof/debug_info.d.ts +14 -56
  138. package/dist/generated-proto/pb_schema/cdp/cof/debug_info.d.ts.map +1 -1
  139. package/dist/generated-proto/pb_schema/cdp/cof/debug_info.js +78 -45
  140. package/dist/generated-proto/pb_schema/cdp/cof/debug_info.js.map +1 -1
  141. package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.d.ts +28 -0
  142. package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.d.ts.map +1 -0
  143. package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.js +89 -0
  144. package/dist/generated-proto/pb_schema/cdp/cof/discover_feed_provided_signals.js.map +1 -0
  145. package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.d.ts +28 -1103
  146. package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.d.ts.map +1 -1
  147. package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.js +358 -210
  148. package/dist/generated-proto/pb_schema/cdp/cof/feature_provided_signals.js.map +1 -1
  149. package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.d.ts +12 -16
  150. package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.d.ts.map +1 -1
  151. package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.js +31 -23
  152. package/dist/generated-proto/pb_schema/cdp/cof/lenses_provided_signals.js.map +1 -1
  153. package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.d.ts +13 -15
  154. package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.d.ts.map +1 -1
  155. package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.js +22 -15
  156. package/dist/generated-proto/pb_schema/cdp/cof/mdp_media_attribution.js.map +1 -1
  157. package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.d.ts +12 -14
  158. package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.d.ts.map +1 -1
  159. package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.js +22 -15
  160. package/dist/generated-proto/pb_schema/cdp/cof/media_provided_signals.js.map +1 -1
  161. package/dist/generated-proto/pb_schema/cdp/cof/namespace.d.ts.map +1 -1
  162. package/dist/generated-proto/pb_schema/cdp/cof/namespace.js +0 -6
  163. package/dist/generated-proto/pb_schema/cdp/cof/namespace.js.map +1 -1
  164. package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.d.ts +12 -16
  165. package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.d.ts.map +1 -1
  166. package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.js +29 -18
  167. package/dist/generated-proto/pb_schema/cdp/cof/opera_provided_signals.js.map +1 -1
  168. package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.d.ts +12 -12
  169. package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.d.ts.map +1 -1
  170. package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.js +16 -13
  171. package/dist/generated-proto/pb_schema/cdp/cof/perception_provided_signals.js.map +1 -1
  172. package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.d.ts +12 -12
  173. package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.d.ts.map +1 -1
  174. package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.js +16 -13
  175. package/dist/generated-proto/pb_schema/cdp/cof/recipients_provided_signals.js.map +1 -1
  176. package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.d.ts +12 -12
  177. package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.d.ts.map +1 -1
  178. package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.js +16 -13
  179. package/dist/generated-proto/pb_schema/cdp/cof/routing_provided_signals.js.map +1 -1
  180. package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.d.ts +12 -12
  181. package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.d.ts.map +1 -1
  182. package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.js +16 -13
  183. package/dist/generated-proto/pb_schema/cdp/cof/snap_kit_provided_signals.js.map +1 -1
  184. package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.d.ts +12 -18
  185. package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.d.ts.map +1 -1
  186. package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.js +35 -20
  187. package/dist/generated-proto/pb_schema/cdp/cof/upload_provided_signals.js.map +1 -1
  188. package/dist/generated-proto/pb_schema/cdp/media/snap_source.d.ts.map +1 -1
  189. package/dist/generated-proto/pb_schema/cdp/media/snap_source.js +0 -6
  190. package/dist/generated-proto/pb_schema/cdp/media/snap_source.js.map +1 -1
  191. package/dist/generated-proto/pb_schema/common/ruid.d.ts +12 -16
  192. package/dist/generated-proto/pb_schema/common/ruid.d.ts.map +1 -1
  193. package/dist/generated-proto/pb_schema/common/ruid.js +28 -17
  194. package/dist/generated-proto/pb_schema/common/ruid.js.map +1 -1
  195. package/dist/generated-proto/pb_schema/common/value.d.ts +25 -123
  196. package/dist/generated-proto/pb_schema/common/value.d.ts.map +1 -1
  197. package/dist/generated-proto/pb_schema/common/value.js +136 -71
  198. package/dist/generated-proto/pb_schema/common/value.js.map +1 -1
  199. package/dist/generated-proto/pb_schema/content/asset.d.ts +12 -14
  200. package/dist/generated-proto/pb_schema/content/asset.d.ts.map +1 -1
  201. package/dist/generated-proto/pb_schema/content/asset.js +22 -15
  202. package/dist/generated-proto/pb_schema/content/asset.js.map +1 -1
  203. package/dist/generated-proto/pb_schema/content/media_reference.d.ts +13 -46
  204. package/dist/generated-proto/pb_schema/content/media_reference.d.ts.map +1 -1
  205. package/dist/generated-proto/pb_schema/content/media_reference.js +86 -47
  206. package/dist/generated-proto/pb_schema/content/media_reference.js.map +1 -1
  207. package/dist/generated-proto/pb_schema/content/media_source.d.ts.map +1 -1
  208. package/dist/generated-proto/pb_schema/content/media_source.js +0 -6
  209. package/dist/generated-proto/pb_schema/content/media_source.js.map +1 -1
  210. package/dist/generated-proto/pb_schema/content/media_types.d.ts.map +1 -1
  211. package/dist/generated-proto/pb_schema/content/media_types.js +0 -6
  212. package/dist/generated-proto/pb_schema/content/media_types.js.map +1 -1
  213. package/dist/generated-proto/pb_schema/google/api/annotations.d.ts.map +1 -1
  214. package/dist/generated-proto/pb_schema/google/api/annotations.js +0 -6
  215. package/dist/generated-proto/pb_schema/google/api/annotations.js.map +1 -1
  216. package/dist/generated-proto/pb_schema/google/api/http.d.ts +15 -3336
  217. package/dist/generated-proto/pb_schema/google/api/http.d.ts.map +1 -1
  218. package/dist/generated-proto/pb_schema/google/api/http.js +129 -68
  219. package/dist/generated-proto/pb_schema/google/api/http.js.map +1 -1
  220. package/dist/generated-proto/pb_schema/google/protobuf/any.d.ts +12 -14
  221. package/dist/generated-proto/pb_schema/google/protobuf/any.d.ts.map +1 -1
  222. package/dist/generated-proto/pb_schema/google/protobuf/any.js +24 -17
  223. package/dist/generated-proto/pb_schema/google/protobuf/any.js.map +1 -1
  224. package/dist/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +126 -50157
  225. package/dist/generated-proto/pb_schema/google/protobuf/descriptor.d.ts.map +1 -1
  226. package/dist/generated-proto/pb_schema/google/protobuf/descriptor.js +1162 -563
  227. package/dist/generated-proto/pb_schema/google/protobuf/descriptor.js.map +1 -1
  228. package/dist/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +12 -14
  229. package/dist/generated-proto/pb_schema/google/protobuf/timestamp.d.ts.map +1 -1
  230. package/dist/generated-proto/pb_schema/google/protobuf/timestamp.js +23 -19
  231. package/dist/generated-proto/pb_schema/google/protobuf/timestamp.js.map +1 -1
  232. package/dist/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +20 -84
  233. package/dist/generated-proto/pb_schema/google/protobuf/wrappers.d.ts.map +1 -1
  234. package/dist/generated-proto/pb_schema/google/protobuf/wrappers.js +141 -77
  235. package/dist/generated-proto/pb_schema/google/protobuf/wrappers.js.map +1 -1
  236. package/dist/generated-proto/pb_schema/lenses/geocircle.d.ts +12 -23
  237. package/dist/generated-proto/pb_schema/lenses/geocircle.d.ts.map +1 -1
  238. package/dist/generated-proto/pb_schema/lenses/geocircle.js +26 -18
  239. package/dist/generated-proto/pb_schema/lenses/geocircle.js.map +1 -1
  240. package/dist/generated-proto/pb_schema/lenses/geopoint.d.ts +12 -14
  241. package/dist/generated-proto/pb_schema/lenses/geopoint.d.ts.map +1 -1
  242. package/dist/generated-proto/pb_schema/lenses/geopoint.js +22 -15
  243. package/dist/generated-proto/pb_schema/lenses/geopoint.js.map +1 -1
  244. package/dist/generated-proto/pb_schema/lenses/launch_params.d.ts +12 -12
  245. package/dist/generated-proto/pb_schema/lenses/launch_params.d.ts.map +1 -1
  246. package/dist/generated-proto/pb_schema/lenses/launch_params.js +18 -15
  247. package/dist/generated-proto/pb_schema/lenses/launch_params.js.map +1 -1
  248. package/dist/generated-proto/pb_schema/lenses/launchdata.d.ts +15 -324
  249. package/dist/generated-proto/pb_schema/lenses/launchdata.d.ts.map +1 -1
  250. package/dist/generated-proto/pb_schema/lenses/launchdata.js +112 -66
  251. package/dist/generated-proto/pb_schema/lenses/launchdata.js.map +1 -1
  252. package/dist/generated-proto/pb_schema/lenses/lures.d.ts +12 -91
  253. package/dist/generated-proto/pb_schema/lenses/lures.d.ts.map +1 -1
  254. package/dist/generated-proto/pb_schema/lenses/lures.js +37 -28
  255. package/dist/generated-proto/pb_schema/lenses/lures.js.map +1 -1
  256. package/dist/generated-proto/pb_schema/lenses/persistent_store.d.ts +12 -12
  257. package/dist/generated-proto/pb_schema/lenses/persistent_store.d.ts.map +1 -1
  258. package/dist/generated-proto/pb_schema/lenses/persistent_store.js +18 -15
  259. package/dist/generated-proto/pb_schema/lenses/persistent_store.js.map +1 -1
  260. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.d.ts +30 -396
  261. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.d.ts.map +1 -1
  262. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js +520 -240
  263. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js.map +1 -1
  264. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.d.ts +30 -2429
  265. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.d.ts.map +1 -1
  266. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.js +991 -440
  267. package/dist/generated-proto/pb_schema/lenses/remote_api/remote_api_spec.js.map +1 -1
  268. package/dist/generated-proto/pb_schema/lenses/snappable.d.ts +27 -783
  269. package/dist/generated-proto/pb_schema/lenses/snappable.d.ts.map +1 -1
  270. package/dist/generated-proto/pb_schema/lenses/snappable.js +502 -245
  271. package/dist/generated-proto/pb_schema/lenses/snappable.js.map +1 -1
  272. package/dist/generated-proto/pb_schema/lenses/user_data.d.ts +15 -174
  273. package/dist/generated-proto/pb_schema/lenses/user_data.d.ts.map +1 -1
  274. package/dist/generated-proto/pb_schema/lenses/user_data.js +144 -77
  275. package/dist/generated-proto/pb_schema/lenses/user_data.js.map +1 -1
  276. package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.d.ts +12 -14
  277. package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.d.ts.map +1 -1
  278. package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.js +24 -17
  279. package/dist/generated-proto/pb_schema/snapdoc/capture_characteristics.js.map +1 -1
  280. package/dist/generated-proto/pb_schema/snapdoc/extensions.d.ts +14 -18
  281. package/dist/generated-proto/pb_schema/snapdoc/extensions.d.ts.map +1 -1
  282. package/dist/generated-proto/pb_schema/snapdoc/extensions.js +29 -18
  283. package/dist/generated-proto/pb_schema/snapdoc/extensions.js.map +1 -1
  284. package/dist/generated-proto/pb_schema/snapdoc/media.d.ts +52 -576
  285. package/dist/generated-proto/pb_schema/snapdoc/media.d.ts.map +1 -1
  286. package/dist/generated-proto/pb_schema/snapdoc/media.js +615 -318
  287. package/dist/generated-proto/pb_schema/snapdoc/media.js.map +1 -1
  288. package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.d.ts.map +1 -1
  289. package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.js +0 -6
  290. package/dist/generated-proto/pb_schema/snapdoc/media_codec_formats.js.map +1 -1
  291. package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.d.ts.map +1 -1
  292. package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.js +0 -6
  293. package/dist/generated-proto/pb_schema/snapdoc/media_file_formats.js.map +1 -1
  294. package/dist/generated-proto/pb_schema/snapdoc/media_id.d.ts +12 -12
  295. package/dist/generated-proto/pb_schema/snapdoc/media_id.d.ts.map +1 -1
  296. package/dist/generated-proto/pb_schema/snapdoc/media_id.js +17 -17
  297. package/dist/generated-proto/pb_schema/snapdoc/media_id.js.map +1 -1
  298. package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.d.ts.map +1 -1
  299. package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.js +0 -6
  300. package/dist/generated-proto/pb_schema/snapdoc/snap_component_type.js.map +1 -1
  301. package/dist/handlers/cameraKitServiceFetchHandlerFactory.d.ts.map +1 -1
  302. package/dist/handlers/cameraKitServiceFetchHandlerFactory.js +1 -1
  303. package/dist/handlers/cameraKitServiceFetchHandlerFactory.js.map +1 -1
  304. package/dist/handlers/defaultFetchHandler.js +1 -1
  305. package/dist/handlers/defaultFetchHandler.js.map +1 -1
  306. package/dist/handlers/requestStateEmittingHandler.js +1 -1
  307. package/dist/handlers/requestStateEmittingHandler.js.map +1 -1
  308. package/dist/index.d.ts +3 -4
  309. package/dist/index.d.ts.map +1 -1
  310. package/dist/index.js +2 -3
  311. package/dist/index.js.map +1 -1
  312. package/dist/legal/legalPrompt.js +1 -1
  313. package/dist/legal/legalPrompt.js.map +1 -1
  314. package/dist/legal/legalState.js +1 -1
  315. package/dist/legal/legalState.js.map +1 -1
  316. package/dist/lens/LensPersistenceStore.js +1 -1
  317. package/dist/lens/LensPersistenceStore.js.map +1 -1
  318. package/dist/lens/LensRepository.js +1 -1
  319. package/dist/lens/LensRepository.js.map +1 -1
  320. package/dist/lens/LensSource.js +1 -1
  321. package/dist/lens/LensSource.js.map +1 -1
  322. package/dist/lens/assets/LensAssetRepository.js +1 -1
  323. package/dist/lens/assets/LensAssetRepository.js.map +1 -1
  324. package/dist/lens/assets/LensAssetsProvider.js +1 -1
  325. package/dist/lens/assets/LensAssetsProvider.js.map +1 -1
  326. package/dist/lens/assets/deviceDependentAssetLoader.js +1 -1
  327. package/dist/lens/assets/deviceDependentAssetLoader.js.map +1 -1
  328. package/dist/lens/assets/remoteMediaAssetLoaderFactory.js +1 -1
  329. package/dist/lens/assets/remoteMediaAssetLoaderFactory.js.map +1 -1
  330. package/dist/lens/assets/staticAssetLoader.js +1 -1
  331. package/dist/lens/assets/staticAssetLoader.js.map +1 -1
  332. package/dist/lens/cameraKitLensSource.d.ts.map +1 -1
  333. package/dist/lens/cameraKitLensSource.js +6 -6
  334. package/dist/lens/cameraKitLensSource.js.map +1 -1
  335. package/dist/lens/fetchWatermarkLens.d.ts.map +1 -1
  336. package/dist/lens/fetchWatermarkLens.js +1 -1
  337. package/dist/lens/fetchWatermarkLens.js.map +1 -1
  338. package/dist/lens/userDataAccessResolver.d.ts +52 -0
  339. package/dist/lens/userDataAccessResolver.d.ts.map +1 -0
  340. package/dist/lens/userDataAccessResolver.js +3 -0
  341. package/dist/lens/userDataAccessResolver.js.map +1 -0
  342. package/dist/lens-client-interface/filePicker.d.ts.map +1 -1
  343. package/dist/lens-client-interface/filePicker.js +1 -1
  344. package/dist/lens-client-interface/filePicker.js.map +1 -1
  345. package/dist/lens-client-interface/lensClientInterface.js +1 -1
  346. package/dist/lens-client-interface/lensClientInterface.js.map +1 -1
  347. package/dist/lens-core-module/loader/bootstrapURLs.d.ts +2 -0
  348. package/dist/lens-core-module/loader/bootstrapURLs.d.ts.map +1 -1
  349. package/dist/lens-core-module/loader/bootstrapURLs.js +22 -11
  350. package/dist/lens-core-module/loader/bootstrapURLs.js.map +1 -1
  351. package/dist/lens-core-module/loader/lensCoreFactory.d.ts.map +1 -1
  352. package/dist/lens-core-module/loader/lensCoreFactory.js +1 -1
  353. package/dist/lens-core-module/loader/lensCoreFactory.js.map +1 -1
  354. package/dist/lensCoreWasmVersions.js +3 -3
  355. package/dist/lensCoreWasmVersions.js.map +1 -1
  356. package/dist/logger/logEntries.js +1 -1
  357. package/dist/logger/logEntries.js.map +1 -1
  358. package/dist/logger/registerLogEntriesSubscriber.d.ts.map +1 -1
  359. package/dist/logger/registerLogEntriesSubscriber.js +1 -1
  360. package/dist/logger/registerLogEntriesSubscriber.js.map +1 -1
  361. package/dist/media-sources/CameraKitSource.d.ts +6 -0
  362. package/dist/media-sources/CameraKitSource.d.ts.map +1 -1
  363. package/dist/media-sources/CameraKitSource.js +2 -2
  364. package/dist/media-sources/CameraKitSource.js.map +1 -1
  365. package/dist/metrics/businessEventsReporter.js +1 -1
  366. package/dist/metrics/businessEventsReporter.js.map +1 -1
  367. package/dist/metrics/metricsEventTarget.js +1 -1
  368. package/dist/metrics/metricsEventTarget.js.map +1 -1
  369. package/dist/metrics/reporters/reportBenchmarks.d.ts.map +1 -1
  370. package/dist/metrics/reporters/reportBenchmarks.js +1 -1
  371. package/dist/metrics/reporters/reportBenchmarks.js.map +1 -1
  372. package/dist/metrics/reporters/reportGlobalException.js +1 -1
  373. package/dist/metrics/reporters/reportGlobalException.js.map +1 -1
  374. package/dist/metrics/reporters/reportHttpMetrics.js +1 -1
  375. package/dist/metrics/reporters/reportHttpMetrics.js.map +1 -1
  376. package/dist/metrics/reporters/reportLegalState.js +1 -1
  377. package/dist/metrics/reporters/reportLegalState.js.map +1 -1
  378. package/dist/metrics/reporters/reportLensAndAssetDownload.d.ts.map +1 -1
  379. package/dist/metrics/reporters/reportLensAndAssetDownload.js +1 -1
  380. package/dist/metrics/reporters/reportLensAndAssetDownload.js.map +1 -1
  381. package/dist/metrics/reporters/reportLensValidationFailed.js +1 -1
  382. package/dist/metrics/reporters/reportLensValidationFailed.js.map +1 -1
  383. package/dist/metrics/reporters/reportLensView.js +1 -1
  384. package/dist/metrics/reporters/reportLensView.js.map +1 -1
  385. package/dist/metrics/reporters/reportLensWait.js +1 -1
  386. package/dist/metrics/reporters/reportLensWait.js.map +1 -1
  387. package/dist/metrics/reporters/reportPlatformCapabilities.d.ts.map +1 -1
  388. package/dist/metrics/reporters/reportPlatformCapabilities.js +1 -1
  389. package/dist/metrics/reporters/reportPlatformCapabilities.js.map +1 -1
  390. package/dist/metrics/reporters/reportSessionException.js +1 -1
  391. package/dist/metrics/reporters/reportSessionException.js.map +1 -1
  392. package/dist/metrics/reporters/reportUserSession.js +1 -1
  393. package/dist/metrics/reporters/reportUserSession.js.map +1 -1
  394. package/dist/metrics/reporters/reporters.d.ts +1 -1
  395. package/dist/metrics/reporters/reporters.d.ts.map +1 -1
  396. package/dist/metrics/reporters/reporters.js +1 -1
  397. package/dist/metrics/reporters/reporters.js.map +1 -1
  398. package/dist/platform/platformCapabilities.d.ts +6 -16
  399. package/dist/platform/platformCapabilities.d.ts.map +1 -1
  400. package/dist/platform/platformCapabilities.js +15 -15
  401. package/dist/platform/platformCapabilities.js.map +1 -1
  402. package/dist/remote-configuration/cofHandler.d.ts.map +1 -1
  403. package/dist/remote-configuration/cofHandler.js +1 -1
  404. package/dist/remote-configuration/cofHandler.js.map +1 -1
  405. package/dist/remote-configuration/preloadConfiguration.js +1 -1
  406. package/dist/remote-configuration/preloadConfiguration.js.map +1 -1
  407. package/dist/remote-configuration/remoteConfiguration.d.ts.map +1 -1
  408. package/dist/remote-configuration/remoteConfiguration.js +1 -1
  409. package/dist/remote-configuration/remoteConfiguration.js.map +1 -1
  410. package/dist/session/CameraKitSession.d.ts +6 -1
  411. package/dist/session/CameraKitSession.d.ts.map +1 -1
  412. package/dist/session/CameraKitSession.js +1 -1
  413. package/dist/session/CameraKitSession.js.map +1 -1
  414. package/dist/session/LensKeyboard.js +1 -1
  415. package/dist/session/LensKeyboard.js.map +1 -1
  416. package/dist/session/lensState.d.ts +3 -2
  417. package/dist/session/lensState.d.ts.map +1 -1
  418. package/dist/session/lensState.js +21 -6
  419. package/dist/session/lensState.js.map +1 -1
  420. package/dist/session/sessionState.js +1 -1
  421. package/dist/session/sessionState.js.map +1 -1
  422. package/docs/html/assets/navigation.js +1 -1
  423. package/docs/html/assets/search.js +1 -1
  424. package/docs/html/classes/CameraKit.html +2 -2
  425. package/docs/html/classes/CameraKitSession.html +7 -3
  426. package/docs/html/classes/CameraKitSource.html +6 -2
  427. package/docs/html/classes/LensPerformanceMeasurement.html +2 -2
  428. package/docs/html/classes/LensPerformanceMetrics.html +2 -2
  429. package/docs/html/classes/LensRepository.html +2 -2
  430. package/docs/html/classes/Transform2D.html +2 -2
  431. package/docs/html/classes/TypedCustomEvent.html +2 -2
  432. package/docs/html/classes/TypedEventTarget.html +2 -2
  433. package/docs/html/enums/Lens_CameraFacing.html +2 -2
  434. package/docs/html/functions/bootstrapCameraKit.html +2 -2
  435. package/docs/html/functions/createExtension.html +2 -2
  436. package/docs/html/functions/createImageSource.html +2 -2
  437. package/docs/html/functions/createMediaStreamSource.html +2 -2
  438. package/docs/html/functions/createVideoSource.html +2 -2
  439. package/docs/html/functions/estimateLensPerformance.html +2 -2
  440. package/docs/html/functions/filePickerFactory.html +2 -4
  441. package/docs/html/functions/lensSourcesFactory.html +3 -5
  442. package/docs/html/functions/remoteApiServicesFactory.html +1 -3
  443. package/docs/html/hierarchy.html +1 -1
  444. package/docs/html/index.html +3 -3
  445. package/docs/html/interfaces/BitmojiUserInfo.html +2 -2
  446. package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +2 -2
  447. package/docs/html/interfaces/CameraKitDeviceOptions.html +2 -2
  448. package/docs/html/interfaces/CameraKitSourceInfo.html +2 -2
  449. package/docs/html/interfaces/CameraKitSourceSubscriber.html +2 -2
  450. package/docs/html/interfaces/ComputedFrameMetrics.html +2 -2
  451. package/docs/html/interfaces/CreateSessionOptions.html +2 -2
  452. package/docs/html/interfaces/EstimatedLensPerformance.html +2 -2
  453. package/docs/html/interfaces/FriendUserInfo.html +2 -2
  454. package/docs/html/interfaces/FunctionSourceOptions.html +2 -2
  455. package/docs/html/interfaces/Lens.html +2 -2
  456. package/docs/html/interfaces/LensCreator.html +2 -2
  457. package/docs/html/interfaces/LensLaunchData.html +2 -2
  458. package/docs/html/interfaces/LensSource.html +2 -2
  459. package/docs/html/interfaces/LensUserData.html +2 -2
  460. package/docs/html/interfaces/LoadAssetRequest.html +2 -2
  461. package/docs/html/interfaces/MediaStreamSourceOptions.html +2 -2
  462. package/docs/html/interfaces/Preview.html +2 -2
  463. package/docs/html/interfaces/RemoteApiRequest.html +2 -2
  464. package/docs/html/interfaces/RemoteApiResponse.html +2 -2
  465. package/docs/html/interfaces/RemoteApiService.html +2 -2
  466. package/docs/html/interfaces/Snapcode.html +2 -2
  467. package/docs/html/interfaces/UriCancelRequest.html +2 -2
  468. package/docs/html/interfaces/UriRequest.html +2 -2
  469. package/docs/html/interfaces/UriResponse.html +2 -2
  470. package/docs/html/interfaces/VideoSourceOptions.html +2 -2
  471. package/docs/html/modules.html +2 -4
  472. package/docs/html/types/ArgumentValidationError.html +2 -2
  473. package/docs/html/types/AssetLoader.html +2 -2
  474. package/docs/html/types/AssetResponse.html +1 -1
  475. package/docs/html/types/AssetTiming.html +2 -2
  476. package/docs/html/types/BenchmarkError.html +1 -1
  477. package/docs/html/types/BootstrapError.html +2 -2
  478. package/docs/html/types/CacheKeyNotFoundError.html +1 -1
  479. package/docs/html/types/CameraKitSessionEventListener.html +2 -2
  480. package/docs/html/types/CameraKitSessionEvents.html +2 -2
  481. package/docs/html/types/CameraKitSourceError.html +1 -1
  482. package/docs/html/types/ConfigurationError.html +2 -2
  483. package/docs/html/types/FetchHandler.html +1 -1
  484. package/docs/html/types/FilePicker.html +2 -2
  485. package/docs/html/types/FilePickerOptions.html +2 -2
  486. package/docs/html/types/FilePickerResult.html +2 -2
  487. package/docs/html/types/Keyboard.html +2 -2
  488. package/docs/html/types/KeyboardEvents.html +2 -2
  489. package/docs/html/types/LegalError.html +1 -1
  490. package/docs/html/types/LensAbortError.html +2 -2
  491. package/docs/html/types/LensAssetError.html +2 -2
  492. package/docs/html/types/LensContentValidationError.html +1 -1
  493. package/docs/html/types/LensError.html +1 -1
  494. package/docs/html/types/LensExecutionError.html +2 -2
  495. package/docs/html/types/LensImagePickerError.html +2 -2
  496. package/docs/html/types/LensLaunchParams.html +2 -2
  497. package/docs/html/types/LensMetricsEvents.html +2 -2
  498. package/docs/html/types/LensPerformanceCluster.html +1 -1
  499. package/docs/html/types/LensView.html +2 -2
  500. package/docs/html/types/LensWait.html +2 -2
  501. package/docs/html/types/Matrix.html +2 -2
  502. package/docs/html/types/PersistentStoreError.html +2 -2
  503. package/docs/html/types/PlatformNotSupportedError.html +2 -2
  504. package/docs/html/types/PublicContainer.html +2 -2
  505. package/docs/html/types/PublicServices.html +2 -2
  506. package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -2
  507. package/docs/html/types/RemoteApiRequestHandler.html +2 -2
  508. package/docs/html/types/RemoteApiServices.html +1 -1
  509. package/docs/html/types/RemoteApiStatus.html +2 -2
  510. package/docs/html/types/RenderTarget.html +2 -2
  511. package/docs/html/types/Uri.html +1 -1
  512. package/docs/html/types/WebGLError.html +1 -1
  513. package/docs/html/types/Zodiac.html +1 -1
  514. package/docs/html/variables/extensionRequestContext.html +2 -2
  515. package/docs/md/README.md +1 -1
  516. package/docs/md/classes/CameraKit.md +1 -1
  517. package/docs/md/classes/CameraKitSession.md +7 -2
  518. package/docs/md/classes/CameraKitSource.md +6 -1
  519. package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
  520. package/docs/md/classes/LensPerformanceMetrics.md +1 -1
  521. package/docs/md/classes/LensRepository.md +1 -1
  522. package/docs/md/classes/Transform2D.md +1 -1
  523. package/docs/md/classes/TypedCustomEvent.md +1 -1
  524. package/docs/md/classes/TypedEventTarget.md +1 -1
  525. package/docs/md/enums/Lens_CameraFacing.md +1 -1
  526. package/docs/md/interfaces/BitmojiUserInfo.md +1 -1
  527. package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +1 -1
  528. package/docs/md/interfaces/CameraKitDeviceOptions.md +1 -1
  529. package/docs/md/interfaces/CameraKitSourceInfo.md +1 -1
  530. package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
  531. package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
  532. package/docs/md/interfaces/CreateSessionOptions.md +1 -1
  533. package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
  534. package/docs/md/interfaces/FriendUserInfo.md +1 -1
  535. package/docs/md/interfaces/FunctionSourceOptions.md +1 -1
  536. package/docs/md/interfaces/Lens.md +1 -1
  537. package/docs/md/interfaces/LensCreator.md +1 -1
  538. package/docs/md/interfaces/LensLaunchData.md +1 -1
  539. package/docs/md/interfaces/LensSource.md +1 -1
  540. package/docs/md/interfaces/LensUserData.md +1 -1
  541. package/docs/md/interfaces/LoadAssetRequest.md +1 -1
  542. package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
  543. package/docs/md/interfaces/Preview.md +1 -1
  544. package/docs/md/interfaces/RemoteApiRequest.md +1 -1
  545. package/docs/md/interfaces/RemoteApiResponse.md +1 -1
  546. package/docs/md/interfaces/RemoteApiService.md +1 -1
  547. package/docs/md/interfaces/Snapcode.md +1 -1
  548. package/docs/md/interfaces/UriCancelRequest.md +1 -1
  549. package/docs/md/interfaces/UriRequest.md +1 -1
  550. package/docs/md/interfaces/UriResponse.md +1 -1
  551. package/docs/md/interfaces/VideoSourceOptions.md +1 -1
  552. package/docs/md/modules.md +5 -166
  553. package/package.json +6 -6
  554. package/dist/dependency-injection/Container.d.ts +0 -177
  555. package/dist/dependency-injection/Container.d.ts.map +0 -1
  556. package/dist/dependency-injection/Container.js +0 -72
  557. package/dist/dependency-injection/Container.js.map +0 -1
  558. package/dist/dependency-injection/Injectable.d.ts +0 -96
  559. package/dist/dependency-injection/Injectable.d.ts.map +0 -1
  560. package/dist/dependency-injection/Injectable.js +0 -37
  561. package/dist/dependency-injection/Injectable.js.map +0 -1
  562. package/dist/dependency-injection/PartialContainer.d.ts +0 -86
  563. package/dist/dependency-injection/PartialContainer.d.ts.map +0 -1
  564. package/dist/dependency-injection/PartialContainer.js +0 -28
  565. package/dist/dependency-injection/PartialContainer.js.map +0 -1
  566. package/dist/dependency-injection/RootServices.d.ts +0 -76
  567. package/dist/dependency-injection/RootServices.d.ts.map +0 -1
  568. package/dist/dependency-injection/RootServices.js.map +0 -1
  569. package/dist/dependency-injection/types.d.ts +0 -57
  570. package/dist/dependency-injection/types.d.ts.map +0 -1
  571. package/dist/dependency-injection/types.js +0 -2
  572. package/dist/dependency-injection/types.js.map +0 -1
  573. package/docs/html/functions/ConcatInjectable.html +0 -19
  574. package/docs/html/functions/Injectable.html +0 -17
  575. /package/dist/{dependency-injection/RootServices.js → RootServices.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"media_id.js","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/media_id.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAIlD,SAAS,iBAAiB;IACtB,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CA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AAC;AASF,SAAS,YAAY,CAAC,IAAU;IAC5B,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AACD,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;IACxB,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAW,CAAC;IAC5B,GAAG,CAAC,SAAS,EAAE,CAAC;CACnB","sourcesContent":["import Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\nexport const protobufPackage = \"snapchat.snapdoc\";\nexport interface MediaId {\n mediaListId: string;\n}\nfunction createBaseMediaId(): MediaId {\n return { mediaListId: \"0\" };\n}\nexport const MediaId = {\n encode(message: MediaId, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (message.mediaListId !== \"0\") {\n writer.uint32(8).int64(message.mediaListId);\n }\n return writer;\n },\n decode(input: _m0.Reader | Uint8Array, length?: number): MediaId {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMediaId();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.mediaListId = longToString(reader.int64() as Long);\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n fromPartial<I extends Exact<DeepPartial<MediaId>, I>>(object: I): MediaId {\n const message = createBaseMediaId();\n message.mediaListId = object.mediaListId ?? \"0\";\n return message;\n },\n};\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\nexport type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {\n [K in keyof T]?: DeepPartial<T[K]>;\n} : Partial<T>;\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin ? P : P & {\n [K in keyof P]: Exact<P[K], I[K]>;\n} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;\nfunction longToString(long: Long) {\n return long.toString();\n}\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n"]}
1
+ {"version":3,"file":"media_id.js","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/media_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAIlD,SAAS,iBAAiB;IACtB,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC;AACD,MAAM,CAAC,MAAM,OAAO,GAAwB;IACxC,MAAM,CAAC,OAAgB,EAAE,SAAuB,IAAI,YAAY,EAAE;QAC9D,IAAI,OAAO,CAAC,WAAW,KAAK,GAAG,EAAE;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SAC/C;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,MAAM,CAAC,KAAgC,EAAE,MAAe;QACpD,MAAM,MAAM,GAAG,KAAK,YAAY,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/E,IAAI,GAAG,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC;QAClE,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE;YACrB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YAC5B,QAAQ,GAAG,KAAK,CAAC,EAAE;gBACf,KAAK,CAAC,CAAC,CAAC;oBACJ,IAAI,GAAG,KAAK,CAAC,EAAE;wBACX,MAAM;qBACT;oBACD,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;oBAChD,SAAS;iBACZ;aACJ;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE;gBAC9B,MAAM;aACT;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SACxB;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IACD,MAAM,CAA2C,IAAQ;QACrD,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAK,EAAU,CAAC,CAAC;IACpD,CAAC;IACD,WAAW,CAA2C,MAAS;;QAC3D,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;QACpC,OAAO,CAAC,WAAW,GAAG,MAAA,MAAM,CAAC,WAAW,mCAAI,GAAG,CAAC;QAChD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAC","sourcesContent":["import { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\nexport const protobufPackage = \"snapchat.snapdoc\";\nexport interface MediaId {\n mediaListId: string;\n}\nfunction createBaseMediaId(): MediaId {\n return { mediaListId: \"0\" };\n}\nexport const MediaId: MessageFns<MediaId> = {\n encode(message: MediaId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n if (message.mediaListId !== \"0\") {\n writer.uint32(8).int64(message.mediaListId);\n }\n return writer;\n },\n decode(input: BinaryReader | Uint8Array, length?: number): MediaId {\n const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseMediaId();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (tag !== 8) {\n break;\n }\n message.mediaListId = reader.int64().toString();\n continue;\n }\n }\n if ((tag & 7) === 4 || tag === 0) {\n break;\n }\n reader.skip(tag & 7);\n }\n return message;\n },\n create<I extends Exact<DeepPartial<MediaId>, I>>(base?: I): MediaId {\n return MediaId.fromPartial(base ?? ({} as any));\n },\n fromPartial<I extends Exact<DeepPartial<MediaId>, I>>(object: I): MediaId {\n const message = createBaseMediaId();\n message.mediaListId = object.mediaListId ?? \"0\";\n return message;\n },\n};\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\nexport type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {\n [K in keyof T]?: DeepPartial<T[K]>;\n} : Partial<T>;\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin ? P : P & {\n [K in keyof P]: Exact<P[K], I[K]>;\n} & {\n [K in Exclude<keyof I, KeysOfUnion<P>>]: never;\n};\nexport interface MessageFns<T> {\n encode(message: T, writer?: BinaryWriter): BinaryWriter;\n decode(input: BinaryReader | Uint8Array, length?: number): T;\n create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;\n fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"snap_component_type.d.ts","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/snap_component_type.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,WAAW,IAAI;IACf,OAAO,IAAI;IACX,UAAU,IAAI;IACd,kBAAkB;IAClB,SAAS,IAAI;IACb,cAAc,IAAI;IAClB,WAAW,KAAK;IAChB,SAAS,KAAK;IACd,WAAW,IAAI;IACf,SAAS,KAAK;IACd,aAAa,KAAK;IAClB,gBAAgB,KAAK;IACrB,UAAU,KAAK;IACf,SAAS,KAAK;IACd,eAAe,KAAK;IACpB,eAAe,KAAK;IACpB,uBAAuB,KAAK;IAC5B,eAAe,KAAK;IACpB,gBAAgB,KAAK;IACrB,UAAU,KAAK;IACf,OAAO,KAAK;IACZ,mBAAmB,KAAK;IACxB,KAAK,KAAK;IACV,eAAe,KAAK;IACpB,cAAc,KAAK;IACnB,sBAAsB,KAAK;IAC3B,wBAAwB,KAAK;IAC7B,wBAAwB,KAAK;IAC7B,uBAAuB,KAAK;IAC5B,gBAAgB,KAAK;IACrB,IAAI,KAAK;IACT,WAAW,KAAK;IAChB,eAAe,KAAK;IACpB,gCAAgC,KAAK;IACrC,kBAAkB;IAClB,YAAY,KAAK;IACjB,SAAS,KAAK;IACd,mBAAmB,KAAK;IACxB,cAAc,KAAK;IACnB,QAAQ,KAAK;IACb,iDAAiD;IACjD,cAAc,KAAK;IACnB,aAAa,KAAK;IAClB,WAAW,KAAK;IAChB,QAAQ,KAAK;IACb,aAAa,KAAK;IAClB,cAAc,KAAK;IACnB,qBAAqB,KAAK;IAC1B,YAAY,KAAK;IACjB,QAAQ,KAAK;IACb,OAAO,KAAK;IACZ,IAAI,KAAK;IACT,iBAAiB,KAAK;IACtB,YAAY,KAAK;CAClB"}
1
+ {"version":3,"file":"snap_component_type.d.ts","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/snap_component_type.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,WAAW,IAAI;IACf,OAAO,IAAI;IACX,UAAU,IAAI;IACd,kBAAkB;IAClB,SAAS,IAAI;IACb,cAAc,IAAI;IAClB,WAAW,KAAK;IAChB,SAAS,KAAK;IACd,WAAW,IAAI;IACf,SAAS,KAAK;IACd,aAAa,KAAK;IAClB,gBAAgB,KAAK;IACrB,UAAU,KAAK;IACf,SAAS,KAAK;IACd,eAAe,KAAK;IACpB,eAAe,KAAK;IACpB,uBAAuB,KAAK;IAC5B,eAAe,KAAK;IACpB,gBAAgB,KAAK;IACrB,UAAU,KAAK;IACf,OAAO,KAAK;IACZ,mBAAmB,KAAK;IACxB,KAAK,KAAK;IACV,eAAe,KAAK;IACpB,cAAc,KAAK;IACnB,sBAAsB,KAAK;IAC3B,wBAAwB,KAAK;IAC7B,wBAAwB,KAAK;IAC7B,uBAAuB,KAAK;IAC5B,gBAAgB,KAAK;IACrB,IAAI,KAAK;IACT,WAAW,KAAK;IAChB,eAAe,KAAK;IACpB,gCAAgC,KAAK;IACrC,kBAAkB;IAClB,YAAY,KAAK;IACjB,SAAS,KAAK;IACd,mBAAmB,KAAK;IACxB,cAAc,KAAK;IACnB,QAAQ,KAAK;IACb,iDAAiD;IACjD,cAAc,KAAK;IACnB,aAAa,KAAK;IAClB,WAAW,KAAK;IAChB,QAAQ,KAAK;IACb,aAAa,KAAK;IAClB,cAAc,KAAK;IACnB,qBAAqB,KAAK;IAC1B,YAAY,KAAK;IACjB,QAAQ,KAAK;IACb,OAAO,KAAK;IACZ,IAAI,KAAK;IACT,iBAAiB,KAAK;IACtB,YAAY,KAAK;CAClB"}
@@ -1,5 +1,3 @@
1
- import Long from "long";
2
- import _m0 from "protobufjs/minimal";
3
1
  export const protobufPackage = "snapchat.snapdoc";
4
2
  export var SnapComponentType;
5
3
  (function (SnapComponentType) {
@@ -59,8 +57,4 @@ export var SnapComponentType;
59
57
  SnapComponentType[SnapComponentType["CAMERA_ATTACHMENT"] = 29] = "CAMERA_ATTACHMENT";
60
58
  SnapComponentType[SnapComponentType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
61
59
  })(SnapComponentType || (SnapComponentType = {}));
62
- if (_m0.util.Long !== Long) {
63
- _m0.util.Long = Long;
64
- _m0.configure();
65
- }
66
60
  //# sourceMappingURL=snap_component_type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snap_component_type.js","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/snap_component_type.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,oBAAoB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAQlD,MAAM,CAAN,IAAY,iBA2DX;AA3DD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,iEAAY,CAAA;IACZ,6DAAU,CAAA;IACV,uEAAe,CAAA;IACf,+DAAW,CAAA;IACX,qEAAc,CAAA;IAEd,mEAAa,CAAA;IACb,6EAAkB,CAAA;IAClB,wEAAgB,CAAA;IAChB,oEAAc,CAAA;IACd,uEAAe,CAAA;IACf,oEAAc,CAAA;IACd,4EAAkB,CAAA;IAClB,kFAAqB,CAAA;IACrB,sEAAe,CAAA;IACf,oEAAc,CAAA;IACd,gFAAoB,CAAA;IACpB,gFAAoB,CAAA;IACpB,gGAA4B,CAAA;IAC5B,gFAAoB,CAAA;IACpB,kFAAqB,CAAA;IACrB,sEAAe,CAAA;IACf,gEAAY,CAAA;IACZ,wFAAwB,CAAA;IACxB,4DAAU,CAAA;IACV,gFAAoB,CAAA;IACpB,8EAAmB,CAAA;IACnB,8FAA2B,CAAA;IAC3B,kGAA6B,CAAA;IAC7B,kGAA6B,CAAA;IAC7B,gGAA4B,CAAA;IAC5B,kFAAqB,CAAA;IACrB,0DAAS,CAAA;IACT,wEAAgB,CAAA;IAChB,gFAAoB,CAAA;IACpB,kHAAqC,CAAA;IAErC,0EAAiB,CAAA;IACjB,oEAAc,CAAA;IACd,wFAAwB,CAAA;IACxB,8EAAmB,CAAA;IACnB,kEAAa,CAAA;IAEb,8EAAmB,CAAA;IACnB,4EAAkB,CAAA;IAClB,wEAAgB,CAAA;IAChB,kEAAa,CAAA;IACb,4EAAkB,CAAA;IAClB,8EAAmB,CAAA;IACnB,4FAA0B,CAAA;IAC1B,0EAAiB,CAAA;IACjB,kEAAa,CAAA;IACb,gEAAY,CAAA;IACZ,0DAAS,CAAA;IACT,oFAAsB,CAAA;IACtB,0EAAiB,CAAA;AACnB,CAAC,EA3DW,iBAAiB,KAAjB,iBAAiB,QA2D5B;AAED,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;IAC1B,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAW,CAAC;IAC5B,GAAG,CAAC,SAAS,EAAE,CAAC;CACjB","sourcesContent":["/* eslint-disable */\nimport Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\n\nexport const protobufPackage = \"snapchat.snapdoc\";\n\n/**\n * The type enum helps us compactly reference each possible component\n * type, avoiding the need for lengthy type name strings and making\n * searching for the component we want nice and fast.\n * Next Tag: 56\n */\nexport enum SnapComponentType {\n UNKNOWN = 0,\n MEDIA = 1,\n DURATION = 2,\n TIMING = 3,\n UNLOCKABLES = 4,\n CONTEXT = 5,\n ATTACHMENT = 6,\n /** @deprecated */\n SNAPPABLE = 7,\n STORY_METADATA = 8,\n GROUP_STORY = 23,\n OUR_STORY = 24,\n ATTRIBUTION = 9,\n THUMBNAIL = 10,\n PREVIEW_FRAME = 46,\n CONTENT_ANALYSIS = 11,\n PROVENANCE = 22,\n PACKAGING = 25,\n CONTENT_TAGGING = 26,\n SNAP_MODERATION = 30,\n CREATIVE_KIT_SOURCE_APP = 31,\n CONTENT_OBJECTS = 32,\n LEGACY_MULTISNAP = 33,\n SPECTACLES = 34,\n CAPTION = 35,\n VIDEO_TRANSCRIPTION = 36,\n REPLY = 37,\n GAME_ATTACHMENT = 38,\n VIDEO_INTERVAL = 39,\n PERMITTED_USER_ACTIONS = 40,\n CREATIVE_TOOLS_ANALYTICS = 41,\n PLAYBACK_CHARACTERISTICS = 42,\n CAPTURE_CHARACTERISTICS = 43,\n STICKER_METADATA = 44,\n LENS = 45,\n ATTACHMENTS = 47,\n GENERATED_CAMEO = 49,\n SNAP_PUBLISHER_CREATION_METADATA = 50,\n /** @deprecated */\n DISTRIBUTION = 51,\n SUBTITLES = 52,\n CAMEO_SNAP_RESOURCE = 53,\n CAMEO_METADATA = 54,\n LOCATION = 55,\n /** CALL_TO_ACTION - Discover-like attachments */\n CALL_TO_ACTION = 48,\n APP_DEEP_LINK = 12,\n APP_INSTALL = 13,\n COMMERCE = 14,\n LENS_CAROUSEL = 15,\n LONGFORM_VIDEO = 16,\n NOTIFICATION_SETTINGS = 17,\n SUBSCRIPTION = 18,\n WEB_PAGE = 19,\n ARTICLE = 27,\n POLL = 28,\n CAMERA_ATTACHMENT = 29,\n UNRECOGNIZED = -1,\n}\n\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n"]}
1
+ {"version":3,"file":"snap_component_type.js","sourceRoot":"","sources":["../../../../src/generated-proto/pb_schema/snapdoc/snap_component_type.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAQlD,MAAM,CAAN,IAAY,iBA2DX;AA3DD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,iEAAY,CAAA;IACZ,6DAAU,CAAA;IACV,uEAAe,CAAA;IACf,+DAAW,CAAA;IACX,qEAAc,CAAA;IAEd,mEAAa,CAAA;IACb,6EAAkB,CAAA;IAClB,wEAAgB,CAAA;IAChB,oEAAc,CAAA;IACd,uEAAe,CAAA;IACf,oEAAc,CAAA;IACd,4EAAkB,CAAA;IAClB,kFAAqB,CAAA;IACrB,sEAAe,CAAA;IACf,oEAAc,CAAA;IACd,gFAAoB,CAAA;IACpB,gFAAoB,CAAA;IACpB,gGAA4B,CAAA;IAC5B,gFAAoB,CAAA;IACpB,kFAAqB,CAAA;IACrB,sEAAe,CAAA;IACf,gEAAY,CAAA;IACZ,wFAAwB,CAAA;IACxB,4DAAU,CAAA;IACV,gFAAoB,CAAA;IACpB,8EAAmB,CAAA;IACnB,8FAA2B,CAAA;IAC3B,kGAA6B,CAAA;IAC7B,kGAA6B,CAAA;IAC7B,gGAA4B,CAAA;IAC5B,kFAAqB,CAAA;IACrB,0DAAS,CAAA;IACT,wEAAgB,CAAA;IAChB,gFAAoB,CAAA;IACpB,kHAAqC,CAAA;IAErC,0EAAiB,CAAA;IACjB,oEAAc,CAAA;IACd,wFAAwB,CAAA;IACxB,8EAAmB,CAAA;IACnB,kEAAa,CAAA;IAEb,8EAAmB,CAAA;IACnB,4EAAkB,CAAA;IAClB,wEAAgB,CAAA;IAChB,kEAAa,CAAA;IACb,4EAAkB,CAAA;IAClB,8EAAmB,CAAA;IACnB,4FAA0B,CAAA;IAC1B,0EAAiB,CAAA;IACjB,kEAAa,CAAA;IACb,gEAAY,CAAA;IACZ,0DAAS,CAAA;IACT,oFAAsB,CAAA;IACtB,0EAAiB,CAAA;AACnB,CAAC,EA3DW,iBAAiB,KAAjB,iBAAiB,QA2D5B","sourcesContent":["// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n// protoc-gen-ts_proto v2.2.4\n// protoc v5.28.2\n// source: snapdoc/snap_component_type.proto\n\n/* eslint-disable */\n\nexport const protobufPackage = \"snapchat.snapdoc\";\n\n/**\n * The type enum helps us compactly reference each possible component\n * type, avoiding the need for lengthy type name strings and making\n * searching for the component we want nice and fast.\n * Next Tag: 56\n */\nexport enum SnapComponentType {\n UNKNOWN = 0,\n MEDIA = 1,\n DURATION = 2,\n TIMING = 3,\n UNLOCKABLES = 4,\n CONTEXT = 5,\n ATTACHMENT = 6,\n /** @deprecated */\n SNAPPABLE = 7,\n STORY_METADATA = 8,\n GROUP_STORY = 23,\n OUR_STORY = 24,\n ATTRIBUTION = 9,\n THUMBNAIL = 10,\n PREVIEW_FRAME = 46,\n CONTENT_ANALYSIS = 11,\n PROVENANCE = 22,\n PACKAGING = 25,\n CONTENT_TAGGING = 26,\n SNAP_MODERATION = 30,\n CREATIVE_KIT_SOURCE_APP = 31,\n CONTENT_OBJECTS = 32,\n LEGACY_MULTISNAP = 33,\n SPECTACLES = 34,\n CAPTION = 35,\n VIDEO_TRANSCRIPTION = 36,\n REPLY = 37,\n GAME_ATTACHMENT = 38,\n VIDEO_INTERVAL = 39,\n PERMITTED_USER_ACTIONS = 40,\n CREATIVE_TOOLS_ANALYTICS = 41,\n PLAYBACK_CHARACTERISTICS = 42,\n CAPTURE_CHARACTERISTICS = 43,\n STICKER_METADATA = 44,\n LENS = 45,\n ATTACHMENTS = 47,\n GENERATED_CAMEO = 49,\n SNAP_PUBLISHER_CREATION_METADATA = 50,\n /** @deprecated */\n DISTRIBUTION = 51,\n SUBTITLES = 52,\n CAMEO_SNAP_RESOURCE = 53,\n CAMEO_METADATA = 54,\n LOCATION = 55,\n /** CALL_TO_ACTION - Discover-like attachments */\n CALL_TO_ACTION = 48,\n APP_DEEP_LINK = 12,\n APP_INSTALL = 13,\n COMMERCE = 14,\n LENS_CAROUSEL = 15,\n LONGFORM_VIDEO = 16,\n NOTIFICATION_SETTINGS = 17,\n SUBSCRIPTION = 18,\n WEB_PAGE = 19,\n ARTICLE = 27,\n POLL = 28,\n CAMERA_ATTACHMENT = 29,\n UNRECOGNIZED = -1,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cameraKitServiceFetchHandlerFactory.d.ts","sourceRoot":"","sources":["../../src/handlers/cameraKitServiceFetchHandlerFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;;;;CAY/C,CAAC"}
1
+ {"version":3,"file":"cameraKitServiceFetchHandlerFactory.d.ts","sourceRoot":"","sources":["../../src/handlers/cameraKitServiceFetchHandlerFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAK1D;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;;;;CAY/C,CAAC"}
@@ -1,6 +1,6 @@
1
+ import { Injectable } from "@snap/ts-inject";
1
2
  import { getCameraKitUserAgent } from "../platform/cameraKitUserAgent";
2
3
  import { configurationToken } from "../configuration";
3
- import { Injectable } from "../dependency-injection/Injectable";
4
4
  import { defaultFetchHandlerFactory } from "./defaultFetchHandler";
5
5
  import { HandlerChainBuilder } from "./HandlerChainBuilder";
6
6
  import { createHeadersModifyingFetchHandler } from "./headersModifyingFetchHandler";
@@ -1 +1 @@
1
- {"version":3,"file":"cameraKitServiceFetchHandlerFactory.js","sourceRoot":"","sources":["../../src/handlers/cameraKitServiceFetchHandlerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AAOpF,MAAM,CAAC,MAAM,mCAAmC,GAAG,UAAU,CACzD,8BAA8B,EAC9B,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,KAAK,CAAU,EAC/D,CAAC,EAAE,QAAQ,EAA0B,EAAE,mBAAiC,EAAE,EAAE;IACxE,OAAO,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,GAAG,CACnD,kCAAkC,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3C,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACpE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACnB,CAAC,CAAC,CACL,CAAC,OAAO,CAAC;AACd,CAAC,CACJ,CAAC","sourcesContent":["import { getCameraKitUserAgent } from \"../platform/cameraKitUserAgent\";\nimport type { CameraKitConfiguration } from \"../configuration\";\nimport { configurationToken } from \"../configuration\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport type { FetchHandler } from \"./defaultFetchHandler\";\nimport { defaultFetchHandlerFactory } from \"./defaultFetchHandler\";\nimport { HandlerChainBuilder } from \"./HandlerChainBuilder\";\nimport { createHeadersModifyingFetchHandler } from \"./headersModifyingFetchHandler\";\n\n/**\n * A Fetch implementation which adds headers required to make authenticated calls to the CameraKit backend service.\n *\n * @internal\n */\nexport const cameraKitServiceFetchHandlerFactory = Injectable(\n \"cameraKitServiceFetchHandler\",\n [configurationToken, defaultFetchHandlerFactory.token] as const,\n ({ apiToken }: CameraKitConfiguration, defaultFetchHandler: FetchHandler) => {\n return new HandlerChainBuilder(defaultFetchHandler).map(\n createHeadersModifyingFetchHandler((headers) => {\n headers.append(\"x-snap-client-user-agent\", getCameraKitUserAgent());\n headers.append(\"authorization\", `Bearer ${apiToken}`);\n return headers;\n })\n ).handler;\n }\n);\n"]}
1
+ {"version":3,"file":"cameraKitServiceFetchHandlerFactory.js","sourceRoot":"","sources":["../../src/handlers/cameraKitServiceFetchHandlerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,gCAAgC,CAAC;AAOpF,MAAM,CAAC,MAAM,mCAAmC,GAAG,UAAU,CACzD,8BAA8B,EAC9B,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,KAAK,CAAU,EAC/D,CAAC,EAAE,QAAQ,EAA0B,EAAE,mBAAiC,EAAE,EAAE;IACxE,OAAO,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,GAAG,CACnD,kCAAkC,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3C,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACpE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACnB,CAAC,CAAC,CACL,CAAC,OAAO,CAAC;AACd,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { getCameraKitUserAgent } from \"../platform/cameraKitUserAgent\";\nimport type { CameraKitConfiguration } from \"../configuration\";\nimport { configurationToken } from \"../configuration\";\nimport type { FetchHandler } from \"./defaultFetchHandler\";\nimport { defaultFetchHandlerFactory } from \"./defaultFetchHandler\";\nimport { HandlerChainBuilder } from \"./HandlerChainBuilder\";\nimport { createHeadersModifyingFetchHandler } from \"./headersModifyingFetchHandler\";\n\n/**\n * A Fetch implementation which adds headers required to make authenticated calls to the CameraKit backend service.\n *\n * @internal\n */\nexport const cameraKitServiceFetchHandlerFactory = Injectable(\n \"cameraKitServiceFetchHandler\",\n [configurationToken, defaultFetchHandlerFactory.token] as const,\n ({ apiToken }: CameraKitConfiguration, defaultFetchHandler: FetchHandler) => {\n return new HandlerChainBuilder(defaultFetchHandler).map(\n createHeadersModifyingFetchHandler((headers) => {\n headers.append(\"x-snap-client-user-agent\", getCameraKitUserAgent());\n headers.append(\"authorization\", `Bearer ${apiToken}`);\n return headers;\n })\n ).handler;\n }\n);\n"]}
@@ -1,4 +1,4 @@
1
- import { Injectable } from "../dependency-injection/Injectable";
1
+ import { Injectable } from "@snap/ts-inject";
2
2
  import { HandlerChainBuilder } from "./HandlerChainBuilder";
3
3
  import { createNoCorsRetryingFetchHandler } from "./noCorsRetryingFetchHandler";
4
4
  import { createRetryingHandler } from "./retryingHandler";
@@ -1 +1 @@
1
- {"version":3,"file":"defaultFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/defaultFetchHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAcxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,qBAAqB,EAAE,GAAiB,EAAE;IAC3F,OAAO,CACH,IAAI,mBAAmB,CAAC,KAAK,CAAC;SAGzB,GAAG,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;SACjD,GAAG,CAAC,gCAAgC,EAAE,CAAC;SACvC,GAAG,CACA,qBAAqB,CAAC;QAClB,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,CAAC,eAAe,EAAE,EAAE;YAGhC,IAAI,eAAe,YAAY,QAAQ,EAAE;gBACrC,IAAI,eAAe,CAAC,EAAE;oBAAE,OAAO,KAAK,CAAC;gBACrC,IAAI,eAAe,CAAC,MAAM,GAAG,GAAG,GAAG,GAAG;oBAAE,OAAO,KAAK,CAAC;aACxD;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ,CAAC,CACL,CAAC,OAAO,CAChB,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { Injectable } from \"../dependency-injection/Injectable\";\nimport { HandlerChainBuilder } from \"./HandlerChainBuilder\";\nimport { createNoCorsRetryingFetchHandler } from \"./noCorsRetryingFetchHandler\";\nimport { createRetryingHandler } from \"./retryingHandler\";\nimport { createTimeoutHandler } from \"./timeoutHandler\";\n\nexport type FetchHandler<R = Response> = (input: RequestInfo, init?: RequestInit) => Promise<R>;\n\n/**\n * The default Fetch implementation, used to make a simple HTTP requests without any custom headers. This can be passed\n * to `HandlerChainBuilder` to form the basis for other Fetch implementations (e.g. with custom headers, which extract\n * the Response body, etc.)\n *\n * Has support for retries, client-side timeout, and navigating federated auth flows that may not support CORs requests.\n *\n * @internal\n */\n\nexport const defaultFetchHandlerFactory = Injectable(\"defaultFetchHandler\", (): FetchHandler => {\n return (\n new HandlerChainBuilder(fetch)\n // The 20-second per-request timeout is pretty arbitrary, it's just set to be longer than our API gateway\n // timeout (15s) and lower than the browsers own timeout (variable, Chrome's is 5m).\n .map(createTimeoutHandler({ timeout: 20 * 1000 }))\n .map(createNoCorsRetryingFetchHandler())\n .map(\n createRetryingHandler({\n maxRetries: 3,\n retryPredicate: (responseOrError) => {\n // Don't retry successful Responses or Responses with a 4xx HTTP status code (indicating a\n // client error). Do retry all 5xx HTTP status codes.\n if (responseOrError instanceof Response) {\n if (responseOrError.ok) return false;\n if (responseOrError.status % 400 < 100) return false;\n }\n return true;\n },\n })\n ).handler\n );\n});\n"]}
1
+ {"version":3,"file":"defaultFetchHandler.js","sourceRoot":"","sources":["../../src/handlers/defaultFetchHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAcxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,qBAAqB,EAAE,GAAiB,EAAE;IAC3F,OAAO,CACH,IAAI,mBAAmB,CAAC,KAAK,CAAC;SAGzB,GAAG,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;SACjD,GAAG,CAAC,gCAAgC,EAAE,CAAC;SACvC,GAAG,CACA,qBAAqB,CAAC;QAClB,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,CAAC,eAAe,EAAE,EAAE;YAGhC,IAAI,eAAe,YAAY,QAAQ,EAAE;gBACrC,IAAI,eAAe,CAAC,EAAE;oBAAE,OAAO,KAAK,CAAC;gBACrC,IAAI,eAAe,CAAC,MAAM,GAAG,GAAG,GAAG,GAAG;oBAAE,OAAO,KAAK,CAAC;aACxD;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ,CAAC,CACL,CAAC,OAAO,CAChB,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { HandlerChainBuilder } from \"./HandlerChainBuilder\";\nimport { createNoCorsRetryingFetchHandler } from \"./noCorsRetryingFetchHandler\";\nimport { createRetryingHandler } from \"./retryingHandler\";\nimport { createTimeoutHandler } from \"./timeoutHandler\";\n\nexport type FetchHandler<R = Response> = (input: RequestInfo, init?: RequestInit) => Promise<R>;\n\n/**\n * The default Fetch implementation, used to make a simple HTTP requests without any custom headers. This can be passed\n * to `HandlerChainBuilder` to form the basis for other Fetch implementations (e.g. with custom headers, which extract\n * the Response body, etc.)\n *\n * Has support for retries, client-side timeout, and navigating federated auth flows that may not support CORs requests.\n *\n * @internal\n */\n\nexport const defaultFetchHandlerFactory = Injectable(\"defaultFetchHandler\", (): FetchHandler => {\n return (\n new HandlerChainBuilder(fetch)\n // The 20-second per-request timeout is pretty arbitrary, it's just set to be longer than our API gateway\n // timeout (15s) and lower than the browsers own timeout (variable, Chrome's is 5m).\n .map(createTimeoutHandler({ timeout: 20 * 1000 }))\n .map(createNoCorsRetryingFetchHandler())\n .map(\n createRetryingHandler({\n maxRetries: 3,\n retryPredicate: (responseOrError) => {\n // Don't retry successful Responses or Responses with a 4xx HTTP status code (indicating a\n // client error). Do retry all 5xx HTTP status codes.\n if (responseOrError instanceof Response) {\n if (responseOrError.ok) return false;\n if (responseOrError.status % 400 < 100) return false;\n }\n return true;\n },\n })\n ).handler\n );\n});\n"]}
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
+ import { Injectable } from "@snap/ts-inject";
2
3
  import { ensureError } from "../common/errorHelpers";
3
- import { Injectable } from "../dependency-injection/Injectable";
4
4
  import { TypedCustomEvent } from "../events/TypedCustomEvent";
5
5
  import { TypedEventTarget } from "../events/TypedEventTarget";
6
6
  import { Timer } from "../metrics/operational/Timer";
@@ -1 +1 @@
1
- {"version":3,"file":"requestStateEmittingHandler.js","sourceRoot":"","sources":["../../src/handlers/requestStateEmittingHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAGrD,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IACxC,IAAI,GAAG,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1C,CAAC,CAAC;AA4BF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,uBAAgD,EAChD,IAA0C,EACnC,EAAE;IACT,MAAM,OAAO,mCAAiB,IAAI,KAAE,SAAS,EAAE,SAAS,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Q,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACZ,sBAAsB,CAAC,uBAAuB,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtG,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAA,CAAC;AAYN,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CACpD,yBAAyB,EACzB,GAA4B,EAAE,CAAC,IAAI,gBAAgB,EAAE,CACxD,CAAC","sourcesContent":["import { ensureError } from \"../common/errorHelpers\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport { TypedCustomEvent } from \"../events/TypedCustomEvent\";\nimport { TypedEventTarget } from \"../events/TypedEventTarget\";\nimport { Timer } from \"../metrics/operational/Timer\";\nimport type { ChainableHandler, RequestMetadata } from \"./HandlerChainBuilder\";\n\nlet requestId = 0;\nconst safeParseInt = (str: string | null) => {\n if (str == null) return 0;\n const maybeInt = parseInt(str);\n return isNaN(maybeInt) ? 0 : maybeInt;\n};\n\ninterface Started {\n requestId: number;\n timer: Timer<\"download_latency\">;\n dimensions: Dimensions;\n}\n\ninterface Completed {\n requestId: number;\n dimensions: Dimensions;\n status: number;\n sizeByte: number;\n}\n\ninterface Errored {\n requestId: number;\n dimensions: Dimensions;\n error: Error;\n}\n\nexport type Dimensions = Record<string, string | undefined>;\n\nexport type RequestStateEvents =\n | TypedCustomEvent<\"started\", Started>\n | TypedCustomEvent<\"completed\", Completed>\n | TypedCustomEvent<\"errored\", Errored>;\n\nexport const dispatchRequestStarted = (\n requestStateEventTarget: RequestStateEventTarget,\n data: Omit<Started, \"requestId\" | \"timer\">\n): Started => {\n const started: Started = { ...data, requestId: requestId++, timer: new Timer(\"download_latency\") };\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"started\", started));\n return started;\n};\n\nexport const dispatchRequestCompleted = (\n requestStateEventTarget: RequestStateEventTarget,\n data: Completed\n): Completed => {\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"completed\", data));\n return data;\n};\n\nexport const dispatchRequestErrored = (requestStateEventTarget: RequestStateEventTarget, data: Errored): Errored => {\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"errored\", data));\n return data;\n};\n\nexport const createRequestStateEmittingHandler =\n <D extends Dimensions = Dimensions>(\n requestStateEventTarget: RequestStateEventTarget\n ): ChainableHandler<[RequestInfo, D], Response, RequestInfo, Response, RequestMetadata> =>\n (next) =>\n async ([request, dimensions], metadata) => {\n const { requestId } = dispatchRequestStarted(requestStateEventTarget, { dimensions });\n try {\n const response = await next(request, metadata);\n const status = response.status;\n const sizeByte = safeParseInt(response.headers.get(\"content-length\"));\n dispatchRequestCompleted(requestStateEventTarget, { requestId, dimensions, status, sizeByte });\n return response;\n } catch (error) {\n dispatchRequestErrored(requestStateEventTarget, { requestId, dimensions, error: ensureError(error) });\n throw error;\n }\n };\n\n/**\n * This event target may be used to listen for any network request state changes initiated by CameraKit.\n *\n * @internal\n */\nexport type RequestStateEventTarget = TypedEventTarget<RequestStateEvents>;\n\n/**\n * @internal\n */\nexport const requestStateEventTargetFactory = Injectable(\n \"requestStateEventTarget\",\n (): RequestStateEventTarget => new TypedEventTarget()\n);\n"]}
1
+ {"version":3,"file":"requestStateEmittingHandler.js","sourceRoot":"","sources":["../../src/handlers/requestStateEmittingHandler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAGrD,IAAI,SAAS,GAAG,CAAC,CAAC;AAClB,MAAM,YAAY,GAAG,CAAC,GAAkB,EAAE,EAAE;IACxC,IAAI,GAAG,IAA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AM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACtE,wBAAwB,CAAC,uBAAuB,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/F,OAAO,QAAQ,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACZ,sBAAsB,CAAC,uBAAuB,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtG,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAA,CAAC;AAYN,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CACpD,yBAAyB,EACzB,GAA4B,EAAE,CAAC,IAAI,gBAAgB,EAAE,CACxD,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { ensureError } from \"../common/errorHelpers\";\nimport { TypedCustomEvent } from \"../events/TypedCustomEvent\";\nimport { TypedEventTarget } from \"../events/TypedEventTarget\";\nimport { Timer } from \"../metrics/operational/Timer\";\nimport type { ChainableHandler, RequestMetadata } from \"./HandlerChainBuilder\";\n\nlet requestId = 0;\nconst safeParseInt = (str: string | null) => {\n if (str == null) return 0;\n const maybeInt = parseInt(str);\n return isNaN(maybeInt) ? 0 : maybeInt;\n};\n\ninterface Started {\n requestId: number;\n timer: Timer<\"download_latency\">;\n dimensions: Dimensions;\n}\n\ninterface Completed {\n requestId: number;\n dimensions: Dimensions;\n status: number;\n sizeByte: number;\n}\n\ninterface Errored {\n requestId: number;\n dimensions: Dimensions;\n error: Error;\n}\n\nexport type Dimensions = Record<string, string | undefined>;\n\nexport type RequestStateEvents =\n | TypedCustomEvent<\"started\", Started>\n | TypedCustomEvent<\"completed\", Completed>\n | TypedCustomEvent<\"errored\", Errored>;\n\nexport const dispatchRequestStarted = (\n requestStateEventTarget: RequestStateEventTarget,\n data: Omit<Started, \"requestId\" | \"timer\">\n): Started => {\n const started: Started = { ...data, requestId: requestId++, timer: new Timer(\"download_latency\") };\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"started\", started));\n return started;\n};\n\nexport const dispatchRequestCompleted = (\n requestStateEventTarget: RequestStateEventTarget,\n data: Completed\n): Completed => {\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"completed\", data));\n return data;\n};\n\nexport const dispatchRequestErrored = (requestStateEventTarget: RequestStateEventTarget, data: Errored): Errored => {\n requestStateEventTarget.dispatchEvent(new TypedCustomEvent(\"errored\", data));\n return data;\n};\n\nexport const createRequestStateEmittingHandler =\n <D extends Dimensions = Dimensions>(\n requestStateEventTarget: RequestStateEventTarget\n ): ChainableHandler<[RequestInfo, D], Response, RequestInfo, Response, RequestMetadata> =>\n (next) =>\n async ([request, dimensions], metadata) => {\n const { requestId } = dispatchRequestStarted(requestStateEventTarget, { dimensions });\n try {\n const response = await next(request, metadata);\n const status = response.status;\n const sizeByte = safeParseInt(response.headers.get(\"content-length\"));\n dispatchRequestCompleted(requestStateEventTarget, { requestId, dimensions, status, sizeByte });\n return response;\n } catch (error) {\n dispatchRequestErrored(requestStateEventTarget, { requestId, dimensions, error: ensureError(error) });\n throw error;\n }\n };\n\n/**\n * This event target may be used to listen for any network request state changes initiated by CameraKit.\n *\n * @internal\n */\nexport type RequestStateEventTarget = TypedEventTarget<RequestStateEvents>;\n\n/**\n * @internal\n */\nexport const requestStateEventTargetFactory = Injectable(\n \"requestStateEventTarget\",\n (): RequestStateEventTarget => new TypedEventTarget()\n);\n"]}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ export { Container, Injectable, InjectableCompat, ConcatInjectable, PartialContainer } from "@snap/ts-inject";
1
2
  export { Keyboard, KeyboardEvents } from "./session/LensKeyboard";
2
3
  export { CameraKitConfiguration, CameraKitBootstrapConfiguration, configurationToken } from "./configuration";
3
4
  export { estimateLensPerformance, EstimatedLensPerformance, LensPerformanceCluster, } from "./benchmark/estimateLensPerformanceCluster";
4
5
  export { createExtension, bootstrapCameraKit, PublicContainer } from "./bootstrapCameraKit";
5
- export { PublicServices } from "./dependency-injection/RootServices";
6
+ export { PublicServices } from "./RootServices";
6
7
  export { extensionRequestContext } from "./extensions/extensionRequestContext";
7
8
  export { LensSource, lensSourcesFactory } from "./lens/LensSource";
8
9
  export { Uri, UriRequest, UriResponse, UriCancelRequest, UriHandler, UriHandlers, uriHandlersFactory, } from "./extensions/UriHandlers";
@@ -28,9 +29,6 @@ export { createVideoSource, VideoSourceOptions } from "./media-sources/VideoSour
28
29
  export { createImageSource } from "./media-sources/ImageSource";
29
30
  export { RenderTarget, CameraKitSession } from "./session/CameraKitSession";
30
31
  export { CameraKitSessionEvents, CameraKitSessionEventListener } from "./session/CameraKitSessionEvents";
31
- export { Container } from "./dependency-injection/Container";
32
- export { Injectable, ConcatInjectable } from "./dependency-injection/Injectable";
33
- export { PartialContainer } from "./dependency-injection/PartialContainer";
34
32
  export { Transform2D, Matrix } from "./transforms/Transform2D";
35
33
  export * from "./namedErrors";
36
34
  export { LensPerformanceMeasurement, ComputedFrameMetrics } from "./session/LensPerformanceMeasurement";
@@ -41,4 +39,5 @@ export { namedError } from "./namedErrors";
41
39
  export { Any } from "./generated-proto/pb_schema/google/protobuf/any";
42
40
  export { LensCore } from "./lens-core-module/lensCore";
43
41
  export { FilePickerOptions, FilePickerResult, FilePicker, filePickerFactory } from "./lens-client-interface/filePicker";
42
+ export { userDataAccessResolverFactory, UserDataAccessResolver } from "./lens/userDataAccessResolver";
44
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAA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AAW,EACX,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,mBAAmB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC/D,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iDAAiD,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAExH,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { Container, Injectable, InjectableCompat, ConcatInjectable, PartialContainer } from "@snap/ts-inject";
1
2
  export { configurationToken } from "./configuration";
2
3
  export { estimateLensPerformance, } from "./benchmark/estimateLensPerformanceCluster";
3
4
  export { createExtension, bootstrapCameraKit } from "./bootstrapCameraKit";
@@ -21,9 +22,6 @@ export { createFunctionSource, } from "./media-sources/FunctionSource";
21
22
  export { createVideoSource } from "./media-sources/VideoSource";
22
23
  export { createImageSource } from "./media-sources/ImageSource";
23
24
  export { CameraKitSession } from "./session/CameraKitSession";
24
- export { Container } from "./dependency-injection/Container";
25
- export { Injectable, ConcatInjectable } from "./dependency-injection/Injectable";
26
- export { PartialContainer } from "./dependency-injection/PartialContainer";
27
25
  export { Transform2D } from "./transforms/Transform2D";
28
26
  export * from "./namedErrors";
29
27
  export { LensPerformanceMeasurement } from "./session/LensPerformanceMeasurement";
@@ -33,4 +31,5 @@ export { TypedEventTarget } from "./events/TypedEventTarget";
33
31
  export { namedError } from "./namedErrors";
34
32
  export { Any } from "./generated-proto/pb_schema/google/protobuf/any";
35
33
  export { filePickerFactory } from "./lens-client-interface/filePicker";
34
+ export { userDataAccessResolverFactory } from "./lens/userDataAccessResolver";
36
35
  //# 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":"AACA,OAAO,EAA2D,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EACH,uBAAuB,GAG1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAmB,MAAM,sBAAsB,CAAC;AAE5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAc,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAOH,kBAAkB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAQH,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAA2C,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5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AAiB,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["export { Keyboard, KeyboardEvents } from \"./session/LensKeyboard\";\nexport { CameraKitConfiguration, CameraKitBootstrapConfiguration, configurationToken } from \"./configuration\";\nexport {\n estimateLensPerformance,\n EstimatedLensPerformance,\n LensPerformanceCluster,\n} from \"./benchmark/estimateLensPerformanceCluster\";\nexport { createExtension, bootstrapCameraKit, PublicContainer } from \"./bootstrapCameraKit\";\nexport { PublicServices } from \"./dependency-injection/RootServices\";\nexport { extensionRequestContext } from \"./extensions/extensionRequestContext\";\nexport { LensSource, lensSourcesFactory } from \"./lens/LensSource\";\nexport {\n Uri,\n UriRequest,\n UriResponse,\n UriCancelRequest,\n UriHandler,\n UriHandlers,\n uriHandlersFactory,\n} from \"./extensions/UriHandlers\";\nexport {\n RemoteApiCancelRequestHandler,\n RemoteApiRequest,\n RemoteApiRequestHandler,\n RemoteApiResponse,\n RemoteApiService,\n RemoteApiServices,\n RemoteApiStatus,\n remoteApiServicesFactory,\n} from \"./extensions/RemoteApiServices\";\nexport { CameraKit, CreateSessionOptions, LensMetricsEvents } from \"./CameraKit\";\nexport { externalMetricsSubjectFactory } from \"./clients/metricsClient\";\nexport { Count } from \"./metrics/operational/Count\";\nexport { Histogram } from \"./metrics/operational/Histogram\";\nexport { Metric } from \"./metrics/operational/Metric\";\nexport { Timer } from \"./metrics/operational/Timer\";\nexport { LensView } from \"./metrics/reporters/reportLensView\";\nexport { LensWait } from \"./metrics/reporters/reportLensWait\";\nexport { Lens, toPublicLens, Snapcode, Preview, Lens_CameraFacing, LensCreator } from \"./lens/Lens\";\nexport { AssetTiming, LensRepository } from \"./lens/LensRepository\";\nexport {\n LensLaunchData,\n LensUserData,\n BitmojiUserInfo,\n FriendUserInfo,\n LensLaunchParams,\n Zodiac,\n} from \"./lens/LensLaunchData\";\nexport { AssetLoader, LoadAssetRequest, AssetResponse } from \"./lens/assets/LensAssetRepository\";\nexport { defaultFetchHandlerFactory, FetchHandler } from \"./handlers/defaultFetchHandler\";\nexport { remoteMediaAssetLoaderFactory } from \"./lens/assets/remoteMediaAssetLoaderFactory\";\nexport {\n CameraKitSource,\n CameraKitSourceInfo,\n CameraKitDeviceOptions,\n CameraKitSourceSubscriber,\n} from \"./media-sources/CameraKitSource\";\nexport { createMediaStreamSource, MediaStreamSourceOptions } from \"./media-sources/MediaStreamSource\";\nexport {\n createFunctionSource,\n FrameFormat,\n FrameInput,\n FrameOutput,\n FunctionSourceOptions,\n MediaSourceFunction,\n} from \"./media-sources/FunctionSource\";\nexport { createVideoSource, VideoSourceOptions } from \"./media-sources/VideoSource\";\nexport { createImageSource } from \"./media-sources/ImageSource\";\nexport { RenderTarget, CameraKitSession } from \"./session/CameraKitSession\";\nexport { CameraKitSessionEvents, CameraKitSessionEventListener } from \"./session/CameraKitSessionEvents\";\nexport { Container } from \"./dependency-injection/Container\";\nexport { Injectable, ConcatInjectable } from \"./dependency-injection/Injectable\";\nexport { PartialContainer } from \"./dependency-injection/PartialContainer\";\nexport { Transform2D, Matrix } from \"./transforms/Transform2D\";\nexport * from \"./namedErrors\";\nexport { LensPerformanceMeasurement, ComputedFrameMetrics } from \"./session/LensPerformanceMeasurement\";\nexport { LensPerformanceMetrics } from \"./session/LensPerformanceMetrics\";\nexport { TypedCustomEvent } from \"./events/TypedCustomEvent\";\nexport { TypedEventTarget } from \"./events/TypedEventTarget\";\nexport { namedError } from \"./namedErrors\";\nexport { Any } from \"./generated-proto/pb_schema/google/protobuf/any\";\nexport { LensCore } from \"./lens-core-module/lensCore\";\n\nexport { FilePickerOptions, FilePickerResult, FilePicker, filePickerFactory } from \"./lens-client-interface/filePicker\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG9G,OAAO,EAA2D,kBAAkB,EAAE,MA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AAU,MAAM,0BAA0B,CAAC;AAC/D,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAwB,MAAM,sCAAsC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iDAAiD,CAAC;AAGtE,OAAO,EAAmD,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAExH,OAAO,EAAE,6BAA6B,EAA0B,MAAM,+BAA+B,CAAC","sourcesContent":["export { Container, Injectable, InjectableCompat, ConcatInjectable, PartialContainer } from \"@snap/ts-inject\";\n\nexport { Keyboard, KeyboardEvents } from \"./session/LensKeyboard\";\nexport { CameraKitConfiguration, CameraKitBootstrapConfiguration, configurationToken } from \"./configuration\";\nexport {\n estimateLensPerformance,\n EstimatedLensPerformance,\n LensPerformanceCluster,\n} from \"./benchmark/estimateLensPerformanceCluster\";\nexport { createExtension, bootstrapCameraKit, PublicContainer } from \"./bootstrapCameraKit\";\nexport { PublicServices } from \"./RootServices\";\nexport { extensionRequestContext } from \"./extensions/extensionRequestContext\";\nexport { LensSource, lensSourcesFactory } from \"./lens/LensSource\";\nexport {\n Uri,\n UriRequest,\n UriResponse,\n UriCancelRequest,\n UriHandler,\n UriHandlers,\n uriHandlersFactory,\n} from \"./extensions/UriHandlers\";\nexport {\n RemoteApiCancelRequestHandler,\n RemoteApiRequest,\n RemoteApiRequestHandler,\n RemoteApiResponse,\n RemoteApiService,\n RemoteApiServices,\n RemoteApiStatus,\n remoteApiServicesFactory,\n} from \"./extensions/RemoteApiServices\";\nexport { CameraKit, CreateSessionOptions, LensMetricsEvents } from \"./CameraKit\";\nexport { externalMetricsSubjectFactory } from \"./clients/metricsClient\";\nexport { Count } from \"./metrics/operational/Count\";\nexport { Histogram } from \"./metrics/operational/Histogram\";\nexport { Metric } from \"./metrics/operational/Metric\";\nexport { Timer } from \"./metrics/operational/Timer\";\nexport { LensView } from \"./metrics/reporters/reportLensView\";\nexport { LensWait } from \"./metrics/reporters/reportLensWait\";\nexport { Lens, toPublicLens, Snapcode, Preview, Lens_CameraFacing, LensCreator } from \"./lens/Lens\";\nexport { AssetTiming, LensRepository } from \"./lens/LensRepository\";\nexport {\n LensLaunchData,\n LensUserData,\n BitmojiUserInfo,\n FriendUserInfo,\n LensLaunchParams,\n Zodiac,\n} from \"./lens/LensLaunchData\";\nexport { AssetLoader, LoadAssetRequest, AssetResponse } from \"./lens/assets/LensAssetRepository\";\nexport { defaultFetchHandlerFactory, FetchHandler } from \"./handlers/defaultFetchHandler\";\nexport { remoteMediaAssetLoaderFactory } from \"./lens/assets/remoteMediaAssetLoaderFactory\";\nexport {\n CameraKitSource,\n CameraKitSourceInfo,\n CameraKitDeviceOptions,\n CameraKitSourceSubscriber,\n} from \"./media-sources/CameraKitSource\";\nexport { createMediaStreamSource, MediaStreamSourceOptions } from \"./media-sources/MediaStreamSource\";\nexport {\n createFunctionSource,\n FrameFormat,\n FrameInput,\n FrameOutput,\n FunctionSourceOptions,\n MediaSourceFunction,\n} from \"./media-sources/FunctionSource\";\nexport { createVideoSource, VideoSourceOptions } from \"./media-sources/VideoSource\";\nexport { createImageSource } from \"./media-sources/ImageSource\";\nexport { RenderTarget, CameraKitSession } from \"./session/CameraKitSession\";\nexport { CameraKitSessionEvents, CameraKitSessionEventListener } from \"./session/CameraKitSessionEvents\";\nexport { Transform2D, Matrix } from \"./transforms/Transform2D\";\nexport * from \"./namedErrors\";\nexport { LensPerformanceMeasurement, ComputedFrameMetrics } from \"./session/LensPerformanceMeasurement\";\nexport { LensPerformanceMetrics } from \"./session/LensPerformanceMetrics\";\nexport { TypedCustomEvent } from \"./events/TypedCustomEvent\";\nexport { TypedEventTarget } from \"./events/TypedEventTarget\";\nexport { namedError } from \"./namedErrors\";\nexport { Any } from \"./generated-proto/pb_schema/google/protobuf/any\";\nexport { LensCore } from \"./lens-core-module/lensCore\";\n\nexport { FilePickerOptions, FilePickerResult, FilePicker, filePickerFactory } from \"./lens-client-interface/filePicker\";\n\nexport { userDataAccessResolverFactory, UserDataAccessResolver } from \"./lens/userDataAccessResolver\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Injectable } from "../dependency-injection/Injectable";
2
+ import { Injectable } from "@snap/ts-inject";
3
3
  import { supportedLocale, localizedString } from "../common/localization";
4
4
  import { showDialog } from "../common/dialog";
5
5
  import { assertUnreachable } from "../common/assertions";
@@ -1 +1 @@
1
- {"version":3,"file":"legalPrompt.js","sourceRoot":"","sources":["../../src/legal/legalPrompt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;OAkBV,CAAC;AAGR,SAAe,aAAa,CAAC,KAAa,EAAE,SAAiB,EAAE,IAAY;;QACvE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC;YAC5B,SAAS,EAAE,QAAQ,CAAC,IAAI;YACxB,UAAU,EAAE,YAAY;YACxB,IAAI,EAAE,eAAe;YACrB,KAAK;YACL,SAAS;YACT,IAAI;YACJ,iBAAiB,EAAE,eAAe,CAAC,mBAAmB,CAAC;YACvD,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,eAAe,CAAC,mBAAmB,CAAC;oBAC1C,GAAG,EAAE,QAAQ;iBAChB;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AAc,CAAC,MAAM;gBACxC,YAAY,EAAE,SAAS,CAAC,MAAM;aACjC,CAAC,CAAC;QACT,MAAM,cAAc,GAAG,eAAe,CAAC,2BAA2B,CAAC,CAAC;QACpE,MAAM,UAAU,GAAG,+BAA+B,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE/E,OAAO;YACH,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC;YAEhC,IAAI;;oBACN,IAAI,CAAC,+BAA+B,EAAE;wBAClC,OAAO,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;qBAClE;oBAED,OAAO,IAAI,EAAE;wBACT,MAAM,YAAY,GAAG,MAAM,sBAAsB,EAAE,CAAC;wBACpD,QAAQ,YAAY,EAAE;4BAClB,KAAK,OAAO,CAAC,CAAC;gCACV,MAAM,YAAY,GAAG,MAAM,sBAAsB,EAAE,CAAC;gCACpD,QAAQ,YAAY,EAAE;oCAClB,KAAK,QAAQ;wCACT,SAAS;oCACb,KAAK,UAAU;wCACX,OAAO,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;oCACnE,KAAK,SAAS;wCACV,OAAO,KAAK,CAAC;oCACjB;wCACI,iBAAiB,CAAC,YAAY,CAAC,CAAC;iCACvC;6BACJ;4BACD,KAAK,OAAO;gCACR,OAAO,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;4BACnE,KAAK,SAAS;gCACV,OAAO,KAAK,CAAC;4BACjB;gCACI,iBAAiB,CAAC,YAAY,CAAC,CAAC;yBACvC;qBACJ;gBACL,CAAC;aAAA;SACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { Injectable } from \"../dependency-injection/Injectable\";\nimport type { LegalDocument, LegalDocument_Type } from \"../generated-proto/pb_schema/camera_kit/v3/legal_prompt\";\nimport { supportedLocale, localizedString } from \"../common/localization\";\nimport { showDialog } from \"../common/dialog\";\nimport { assertUnreachable } from \"../common/assertions\";\nimport { computeHash } from \"../common/hash\";\n\n/* eslint-disable max-len */\nconst snapIcon = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" viewBox=\"0 0 32 32\" height=\"48px\">\n <g>\n <path\n d=\"M 30.898 23.477 C 30.77 23.045 30.148 22.743 30.148 22.743 C 30.092 22.71 30.039 22.684 29.994 22.663 C 28.962 22.161 28.048 21.561 27.277 20.876 C 26.659 20.325 26.128 19.719 25.701 19.074 C 25.182 18.288 24.937 17.632 24.831 17.275 C 24.773 17.043 24.782 16.951 24.831 16.832 C 24.873 16.731 24.99 16.632 25.049 16.588 C 25.397 16.341 25.96 15.976 26.303 15.75 C 26.602 15.556 26.859 15.389 27.009 15.283 C 27.494 14.944 27.824 14.596 28.02 14.223 C 28.275 13.74 28.303 13.208 28.107 12.684 C 27.84 11.978 27.184 11.556 26.35 11.556 C 26.163 11.556 25.974 11.577 25.785 11.62 C 25.308 11.723 24.852 11.894 24.474 12.042 C 24.446 12.054 24.416 12.032 24.418 12.002 C 24.457 11.059 24.502 9.79 24.399 8.584 C 24.306 7.493 24.082 6.576 23.717 5.776 C 23.351 4.972 22.874 4.376 22.5 3.947 C 22.143 3.536 21.519 2.936 20.577 2.394 C 19.251 1.631 17.742 1.244 16.09 1.244 C 14.443 1.244 12.934 1.631 11.605 2.394 C 10.607 2.966 9.97 3.614 9.678 3.947 C 9.304 4.376 8.827 4.972 8.46 5.776 C 8.096 6.576 7.872 7.496 7.778 8.584 C 7.673 9.792 7.715 10.96 7.76 11.999 C 7.762 12.03 7.732 12.051 7.704 12.039 C 7.325 11.892 6.87 11.72 6.393 11.617 C 6.204 11.575 6.012 11.554 5.828 11.554 C 4.994 11.554 4.337 11.976 4.071 12.682 C 3.875 13.205 3.903 13.738 4.157 14.221 C 4.354 14.594 4.685 14.941 5.169 15.281 C 5.318 15.387 5.575 15.553 5.874 15.748 C 6.211 15.968 6.758 16.323 7.108 16.569 C 7.152 16.599 7.299 16.712 7.346 16.827 C 7.397 16.951 7.404 17.045 7.341 17.289 C 7.234 17.648 6.989 18.298 6.479 19.069 C 6.052 19.715 5.522 20.32 4.902 20.871 C 4.132 21.556 3.218 22.157 2.186 22.658 C 2.137 22.682 2.078 22.712 2.015 22.748 C 2.015 22.748 1.399 23.064 1.282 23.472 C 1.109 24.075 1.567 24.64 2.036 24.943 C 2.8 25.438 3.732 25.703 4.272 25.849 C 4.421 25.889 4.559 25.926 4.683 25.964 C 4.76 25.989 4.956 26.062 5.038 26.17 C 5.143 26.306 5.155 26.473 5.192 26.66 C 5.253 26.977 5.384 27.373 5.774 27.643 C 6.204 27.941 6.75 27.962 7.444 27.99 C 8.168 28.018 9.07 28.054 10.1 28.394 C 10.579 28.553 11.011 28.818 11.514 29.128 C 12.56 29.773 13.864 30.578 16.09 30.578 C 18.318 30.578 19.629 29.768 20.685 29.119 C 21.183 28.811 21.612 28.546 22.08 28.391 C 23.11 28.049 24.011 28.014 24.735 27.988 C 25.427 27.962 25.974 27.941 26.404 27.641 C 26.822 27.35 26.943 26.918 26.997 26.59 C 27.027 26.428 27.046 26.285 27.14 26.165 C 27.219 26.064 27.399 25.992 27.483 25.964 C 27.609 25.924 27.751 25.886 27.906 25.844 C 28.445 25.698 29.123 25.527 29.945 25.061 C 30.933 24.511 31.001 23.82 30.898 23.477\"\n fill=\"#ffffff\"\n stroke=\"#00000000\"\n stroke-width=\"1\"\n />\n </g>\n <g>\n <path\n d=\"M 29.56 24.299 C 28.21 25.045 27.312 24.965 26.613 25.414 C 26.021 25.795 26.37 26.618 25.939 26.915 C 25.411 27.279 23.843 26.889 21.822 27.555 C 20.155 28.107 19.09 29.689 16.089 29.689 C 13.081 29.689 12.047 28.114 10.357 27.555 C 8.335 26.889 6.768 27.279 6.24 26.915 C 5.809 26.618 6.16 25.795 5.566 25.414 C 4.869 24.965 3.969 25.045 2.619 24.299 C 1.758 23.825 2.247 23.53 2.532 23.393 C 7.426 21.027 8.204 17.372 8.24 17.096 C 8.282 16.769 8.328 16.509 7.966 16.175 C 7.615 15.853 6.066 14.895 5.636 14.593 C 4.925 14.098 4.612 13.6 4.841 12.99 C 5 12.569 5.395 12.41 5.812 12.41 C 5.94 12.41 6.071 12.426 6.2 12.452 C 6.981 12.623 7.741 13.013 8.179 13.118 C 8.24 13.132 8.293 13.139 8.34 13.139 C 8.574 13.139 8.656 13.022 8.639 12.754 C 8.59 11.9 8.469 10.234 8.602 8.677 C 8.787 6.536 9.477 5.476 10.298 4.538 C 10.693 4.087 12.543 2.133 16.082 2.133 C 19.633 2.133 21.474 4.087 21.867 4.538 C 22.688 5.478 23.378 6.536 23.563 8.677 C 23.698 10.234 23.581 11.898 23.525 12.754 C 23.506 13.034 23.591 13.139 23.825 13.139 C 23.872 13.139 23.925 13.132 23.986 13.118 C 24.426 13.013 25.184 12.62 25.965 12.452 C 26.091 12.424 26.222 12.41 26.353 12.41 C 26.77 12.41 27.165 12.569 27.324 12.99 C 27.555 13.6 27.242 14.095 26.529 14.593 C 26.098 14.892 24.547 15.85 24.199 16.175 C 23.836 16.509 23.883 16.767 23.925 17.096 C 23.96 17.372 24.739 21.025 29.633 23.393 C 29.932 23.53 30.421 23.825 29.56 24.299 M 31.709 23.12 C 31.489 22.523 31.07 22.203 30.594 21.939 C 30.505 21.887 30.423 21.845 30.355 21.812 C 30.212 21.74 30.067 21.667 29.922 21.592 C 28.435 20.806 27.275 19.812 26.469 18.635 C 26.198 18.238 26.008 17.88 25.877 17.587 C 25.809 17.391 25.811 17.281 25.86 17.178 C 25.898 17.101 25.996 17.019 26.05 16.979 C 26.305 16.811 26.57 16.64 26.748 16.525 C 27.067 16.319 27.317 16.156 27.481 16.043 C 28.093 15.617 28.519 15.164 28.786 14.658 C 29.163 13.945 29.21 13.131 28.919 12.363 C 28.517 11.301 27.509 10.642 26.291 10.642 C 26.038 10.642 25.783 10.67 25.527 10.726 C 25.46 10.74 25.394 10.756 25.328 10.773 C 25.34 10.05 25.324 9.278 25.258 8.524 C 25.029 5.872 24.099 4.48 23.129 3.371 C 22.724 2.908 22.021 2.232 20.964 1.628 C 19.491 0.781 17.821 0.356 16 0.356 C 14.185 0.356 12.518 0.781 11.044 1.623 C 9.983 2.229 9.278 2.905 8.875 3.366 C 7.905 4.475 6.975 5.867 6.746 8.52 C 6.68 9.273 6.663 10.045 6.675 10.768 C 6.61 10.752 6.544 10.735 6.476 10.721 C 6.221 10.665 5.965 10.637 5.713 10.637 C 4.494 10.637 3.487 11.297 3.084 12.359 C 2.794 13.126 2.841 13.94 3.218 14.654 C 3.485 15.159 3.911 15.613 4.522 16.039 C 4.686 16.153 4.937 16.314 5.256 16.52 C 5.427 16.633 5.68 16.794 5.926 16.958 C 5.963 16.984 6.097 17.082 6.141 17.173 C 6.193 17.279 6.195 17.393 6.118 17.604 C 5.987 17.891 5.801 18.242 5.535 18.631 C 4.747 19.782 3.62 20.757 2.18 21.536 C 1.419 21.941 0.54 22.355 0.29 23.118 C 0.039 23.88 0.203 24.582 0.842 25.239 C 1.053 25.466 1.318 25.665 1.653 25.85 C 2.438 26.283 3.105 26.496 3.63 26.641 C 3.721 26.669 3.937 26.736 4.031 26.819 C 4.265 27.022 4.23 27.331 4.543 27.78 C 4.731 28.061 4.949 28.25 5.129 28.374 C 5.783 28.826 6.516 28.854 7.294 28.881 C 7.997 28.908 8.793 28.94 9.702 29.24 C 10.079 29.364 10.47 29.605 10.922 29.883 C 12.011 30.552 13.501 31.467 15.998 31.467 C 18.493 31.467 19.995 30.547 21.091 29.876 C 21.541 29.6 21.93 29.361 22.297 29.242 C 23.206 28.942 24.003 28.912 24.706 28.884 C 25.483 28.854 26.216 28.826 26.87 28.377 C 27.076 28.234 27.331 28.004 27.535 27.651 C 27.76 27.272 27.753 27.003 27.964 26.821 C 28.05 26.746 28.238 26.68 28.338 26.65 C 28.868 26.505 29.545 26.292 30.344 25.852 C 30.697 25.658 30.976 25.443 31.192 25.2 C 31.194 25.197 31.196 25.192 31.199 25.19 C 31.805 24.544 31.955 23.787 31.709 23.12\"\n fill=\"#000000\"\n stroke=\"#00000000\"\n stroke-width=\"1\"\n />\n </g>\n</svg>`;\n/* eslint-enable */\n\nasync function showTosDialog(title: string, titleText: string, body: string) {\n const result = await showDialog({\n container: document.body,\n dataTestId: \"tos-dialog\",\n lang: supportedLocale,\n title,\n titleText,\n body,\n dismissButtonText: localizedString(\"legalPromptReject\"),\n buttons: [\n {\n text: localizedString(\"legalPromptAccept\"),\n key: \"accept\",\n },\n ],\n });\n return result === \"accept\";\n}\n\nfunction showAdultOrChildDialog() {\n return showDialog({\n container: document.body,\n dataTestId: \"adult-or-child-dialog\",\n lang: supportedLocale,\n title: localizedString(\"legalPromptVariantGAdultOrChild\"),\n buttons: [\n {\n text: localizedString(\"legalPromptVariantGAdult\"),\n key: \"adult\",\n },\n {\n text: localizedString(\"legalPromptVariantGChild\"),\n key: \"child\",\n },\n ],\n });\n}\n\nfunction showFindGuardianDialog() {\n return showDialog({\n container: document.body,\n dataTestId: \"find-guardian-dialog\",\n lang: supportedLocale,\n title: localizedString(\"legalPromptVariantGFindYourParent\"),\n buttons: [\n {\n text: localizedString(\"legalPromptVariantGIAmGuardian\"),\n key: \"guardian\",\n },\n {\n text: localizedString(\"legalPromptVariantGCancel\"),\n key: \"cancel\",\n isSecondary: true,\n },\n ],\n });\n}\n\nexport type LegalPromptFactory = (\n privacyPolicy: LegalDocument & { type: LegalDocument_Type.PRIVACY_POLICY },\n termsOfService: LegalDocument & { type: LegalDocument_Type.TERMS_OF_SERVICE },\n learnMore: LegalDocument & { type: LegalDocument_Type.LEARN_MORE },\n childrenProtectionActRestricted: boolean\n) => LegalPrompt;\n\nexport type LegalPrompt = {\n contentHash: string;\n show: () => Promise<boolean>;\n};\n\n/**\n * @internal\n */\nexport const legalPromptFactory = Injectable(\"legalPrompt\", (): LegalPromptFactory => {\n return function legalPrompt(\n privacyPolicy: LegalDocument & { type: LegalDocument_Type.PRIVACY_POLICY },\n termsOfService: LegalDocument & { type: LegalDocument_Type.TERMS_OF_SERVICE },\n learnMore: LegalDocument & { type: LegalDocument_Type.LEARN_MORE },\n childrenProtectionActRestricted: boolean\n ) {\n const legalMessage = childrenProtectionActRestricted\n ? localizedString(\"legalPromptVariantGMessage\")\n : localizedString(\"legalPromptMessage\")({\n privacyPolicyUrl: privacyPolicy.webUrl,\n termsOfServiceUrl: termsOfService.webUrl,\n learnMoreUrl: learnMore.webUrl,\n });\n const legalTitleText = localizedString(\"legalPromptTermsOfService\");\n const legalTitle = childrenProtectionActRestricted ? legalTitleText : snapIcon;\n\n return {\n contentHash: computeHash(legalMessage),\n\n async show() {\n if (!childrenProtectionActRestricted) {\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n }\n\n while (true) {\n const adultOrChild = await showAdultOrChildDialog();\n switch (adultOrChild) {\n case \"child\": {\n const findGuardian = await showFindGuardianDialog();\n switch (findGuardian) {\n case \"cancel\":\n continue;\n case \"guardian\":\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n case \"dismiss\":\n return false;\n default:\n assertUnreachable(findGuardian);\n }\n }\n case \"adult\":\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n case \"dismiss\":\n return false;\n default:\n assertUnreachable(adultOrChild);\n }\n }\n },\n };\n };\n});\n"]}
1
+ {"version":3,"file":"legalPrompt.js","sourceRoot":"","sources":["../../src/legal/legalPrompt.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;OAkBV,CAAC;AAGR,SAAe,aAAa,CAAC,KAAa,EA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AC,CAAC;4BACnE,KAAK,SAAS;gCACV,OAAO,KAAK,CAAC;4BACjB;gCACI,iBAAiB,CAAC,YAAY,CAAC,CAAC;yBACvC;qBACJ;gBACL,CAAC;aAAA;SACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { LegalDocument, LegalDocument_Type } from \"../generated-proto/pb_schema/camera_kit/v3/legal_prompt\";\nimport { supportedLocale, localizedString } from \"../common/localization\";\nimport { showDialog } from \"../common/dialog\";\nimport { assertUnreachable } from \"../common/assertions\";\nimport { computeHash } from \"../common/hash\";\n\n/* eslint-disable max-len */\nconst snapIcon = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" viewBox=\"0 0 32 32\" height=\"48px\">\n <g>\n <path\n d=\"M 30.898 23.477 C 30.77 23.045 30.148 22.743 30.148 22.743 C 30.092 22.71 30.039 22.684 29.994 22.663 C 28.962 22.161 28.048 21.561 27.277 20.876 C 26.659 20.325 26.128 19.719 25.701 19.074 C 25.182 18.288 24.937 17.632 24.831 17.275 C 24.773 17.043 24.782 16.951 24.831 16.832 C 24.873 16.731 24.99 16.632 25.049 16.588 C 25.397 16.341 25.96 15.976 26.303 15.75 C 26.602 15.556 26.859 15.389 27.009 15.283 C 27.494 14.944 27.824 14.596 28.02 14.223 C 28.275 13.74 28.303 13.208 28.107 12.684 C 27.84 11.978 27.184 11.556 26.35 11.556 C 26.163 11.556 25.974 11.577 25.785 11.62 C 25.308 11.723 24.852 11.894 24.474 12.042 C 24.446 12.054 24.416 12.032 24.418 12.002 C 24.457 11.059 24.502 9.79 24.399 8.584 C 24.306 7.493 24.082 6.576 23.717 5.776 C 23.351 4.972 22.874 4.376 22.5 3.947 C 22.143 3.536 21.519 2.936 20.577 2.394 C 19.251 1.631 17.742 1.244 16.09 1.244 C 14.443 1.244 12.934 1.631 11.605 2.394 C 10.607 2.966 9.97 3.614 9.678 3.947 C 9.304 4.376 8.827 4.972 8.46 5.776 C 8.096 6.576 7.872 7.496 7.778 8.584 C 7.673 9.792 7.715 10.96 7.76 11.999 C 7.762 12.03 7.732 12.051 7.704 12.039 C 7.325 11.892 6.87 11.72 6.393 11.617 C 6.204 11.575 6.012 11.554 5.828 11.554 C 4.994 11.554 4.337 11.976 4.071 12.682 C 3.875 13.205 3.903 13.738 4.157 14.221 C 4.354 14.594 4.685 14.941 5.169 15.281 C 5.318 15.387 5.575 15.553 5.874 15.748 C 6.211 15.968 6.758 16.323 7.108 16.569 C 7.152 16.599 7.299 16.712 7.346 16.827 C 7.397 16.951 7.404 17.045 7.341 17.289 C 7.234 17.648 6.989 18.298 6.479 19.069 C 6.052 19.715 5.522 20.32 4.902 20.871 C 4.132 21.556 3.218 22.157 2.186 22.658 C 2.137 22.682 2.078 22.712 2.015 22.748 C 2.015 22.748 1.399 23.064 1.282 23.472 C 1.109 24.075 1.567 24.64 2.036 24.943 C 2.8 25.438 3.732 25.703 4.272 25.849 C 4.421 25.889 4.559 25.926 4.683 25.964 C 4.76 25.989 4.956 26.062 5.038 26.17 C 5.143 26.306 5.155 26.473 5.192 26.66 C 5.253 26.977 5.384 27.373 5.774 27.643 C 6.204 27.941 6.75 27.962 7.444 27.99 C 8.168 28.018 9.07 28.054 10.1 28.394 C 10.579 28.553 11.011 28.818 11.514 29.128 C 12.56 29.773 13.864 30.578 16.09 30.578 C 18.318 30.578 19.629 29.768 20.685 29.119 C 21.183 28.811 21.612 28.546 22.08 28.391 C 23.11 28.049 24.011 28.014 24.735 27.988 C 25.427 27.962 25.974 27.941 26.404 27.641 C 26.822 27.35 26.943 26.918 26.997 26.59 C 27.027 26.428 27.046 26.285 27.14 26.165 C 27.219 26.064 27.399 25.992 27.483 25.964 C 27.609 25.924 27.751 25.886 27.906 25.844 C 28.445 25.698 29.123 25.527 29.945 25.061 C 30.933 24.511 31.001 23.82 30.898 23.477\"\n fill=\"#ffffff\"\n stroke=\"#00000000\"\n stroke-width=\"1\"\n />\n </g>\n <g>\n <path\n d=\"M 29.56 24.299 C 28.21 25.045 27.312 24.965 26.613 25.414 C 26.021 25.795 26.37 26.618 25.939 26.915 C 25.411 27.279 23.843 26.889 21.822 27.555 C 20.155 28.107 19.09 29.689 16.089 29.689 C 13.081 29.689 12.047 28.114 10.357 27.555 C 8.335 26.889 6.768 27.279 6.24 26.915 C 5.809 26.618 6.16 25.795 5.566 25.414 C 4.869 24.965 3.969 25.045 2.619 24.299 C 1.758 23.825 2.247 23.53 2.532 23.393 C 7.426 21.027 8.204 17.372 8.24 17.096 C 8.282 16.769 8.328 16.509 7.966 16.175 C 7.615 15.853 6.066 14.895 5.636 14.593 C 4.925 14.098 4.612 13.6 4.841 12.99 C 5 12.569 5.395 12.41 5.812 12.41 C 5.94 12.41 6.071 12.426 6.2 12.452 C 6.981 12.623 7.741 13.013 8.179 13.118 C 8.24 13.132 8.293 13.139 8.34 13.139 C 8.574 13.139 8.656 13.022 8.639 12.754 C 8.59 11.9 8.469 10.234 8.602 8.677 C 8.787 6.536 9.477 5.476 10.298 4.538 C 10.693 4.087 12.543 2.133 16.082 2.133 C 19.633 2.133 21.474 4.087 21.867 4.538 C 22.688 5.478 23.378 6.536 23.563 8.677 C 23.698 10.234 23.581 11.898 23.525 12.754 C 23.506 13.034 23.591 13.139 23.825 13.139 C 23.872 13.139 23.925 13.132 23.986 13.118 C 24.426 13.013 25.184 12.62 25.965 12.452 C 26.091 12.424 26.222 12.41 26.353 12.41 C 26.77 12.41 27.165 12.569 27.324 12.99 C 27.555 13.6 27.242 14.095 26.529 14.593 C 26.098 14.892 24.547 15.85 24.199 16.175 C 23.836 16.509 23.883 16.767 23.925 17.096 C 23.96 17.372 24.739 21.025 29.633 23.393 C 29.932 23.53 30.421 23.825 29.56 24.299 M 31.709 23.12 C 31.489 22.523 31.07 22.203 30.594 21.939 C 30.505 21.887 30.423 21.845 30.355 21.812 C 30.212 21.74 30.067 21.667 29.922 21.592 C 28.435 20.806 27.275 19.812 26.469 18.635 C 26.198 18.238 26.008 17.88 25.877 17.587 C 25.809 17.391 25.811 17.281 25.86 17.178 C 25.898 17.101 25.996 17.019 26.05 16.979 C 26.305 16.811 26.57 16.64 26.748 16.525 C 27.067 16.319 27.317 16.156 27.481 16.043 C 28.093 15.617 28.519 15.164 28.786 14.658 C 29.163 13.945 29.21 13.131 28.919 12.363 C 28.517 11.301 27.509 10.642 26.291 10.642 C 26.038 10.642 25.783 10.67 25.527 10.726 C 25.46 10.74 25.394 10.756 25.328 10.773 C 25.34 10.05 25.324 9.278 25.258 8.524 C 25.029 5.872 24.099 4.48 23.129 3.371 C 22.724 2.908 22.021 2.232 20.964 1.628 C 19.491 0.781 17.821 0.356 16 0.356 C 14.185 0.356 12.518 0.781 11.044 1.623 C 9.983 2.229 9.278 2.905 8.875 3.366 C 7.905 4.475 6.975 5.867 6.746 8.52 C 6.68 9.273 6.663 10.045 6.675 10.768 C 6.61 10.752 6.544 10.735 6.476 10.721 C 6.221 10.665 5.965 10.637 5.713 10.637 C 4.494 10.637 3.487 11.297 3.084 12.359 C 2.794 13.126 2.841 13.94 3.218 14.654 C 3.485 15.159 3.911 15.613 4.522 16.039 C 4.686 16.153 4.937 16.314 5.256 16.52 C 5.427 16.633 5.68 16.794 5.926 16.958 C 5.963 16.984 6.097 17.082 6.141 17.173 C 6.193 17.279 6.195 17.393 6.118 17.604 C 5.987 17.891 5.801 18.242 5.535 18.631 C 4.747 19.782 3.62 20.757 2.18 21.536 C 1.419 21.941 0.54 22.355 0.29 23.118 C 0.039 23.88 0.203 24.582 0.842 25.239 C 1.053 25.466 1.318 25.665 1.653 25.85 C 2.438 26.283 3.105 26.496 3.63 26.641 C 3.721 26.669 3.937 26.736 4.031 26.819 C 4.265 27.022 4.23 27.331 4.543 27.78 C 4.731 28.061 4.949 28.25 5.129 28.374 C 5.783 28.826 6.516 28.854 7.294 28.881 C 7.997 28.908 8.793 28.94 9.702 29.24 C 10.079 29.364 10.47 29.605 10.922 29.883 C 12.011 30.552 13.501 31.467 15.998 31.467 C 18.493 31.467 19.995 30.547 21.091 29.876 C 21.541 29.6 21.93 29.361 22.297 29.242 C 23.206 28.942 24.003 28.912 24.706 28.884 C 25.483 28.854 26.216 28.826 26.87 28.377 C 27.076 28.234 27.331 28.004 27.535 27.651 C 27.76 27.272 27.753 27.003 27.964 26.821 C 28.05 26.746 28.238 26.68 28.338 26.65 C 28.868 26.505 29.545 26.292 30.344 25.852 C 30.697 25.658 30.976 25.443 31.192 25.2 C 31.194 25.197 31.196 25.192 31.199 25.19 C 31.805 24.544 31.955 23.787 31.709 23.12\"\n fill=\"#000000\"\n stroke=\"#00000000\"\n stroke-width=\"1\"\n />\n </g>\n</svg>`;\n/* eslint-enable */\n\nasync function showTosDialog(title: string, titleText: string, body: string) {\n const result = await showDialog({\n container: document.body,\n dataTestId: \"tos-dialog\",\n lang: supportedLocale,\n title,\n titleText,\n body,\n dismissButtonText: localizedString(\"legalPromptReject\"),\n buttons: [\n {\n text: localizedString(\"legalPromptAccept\"),\n key: \"accept\",\n },\n ],\n });\n return result === \"accept\";\n}\n\nfunction showAdultOrChildDialog() {\n return showDialog({\n container: document.body,\n dataTestId: \"adult-or-child-dialog\",\n lang: supportedLocale,\n title: localizedString(\"legalPromptVariantGAdultOrChild\"),\n buttons: [\n {\n text: localizedString(\"legalPromptVariantGAdult\"),\n key: \"adult\",\n },\n {\n text: localizedString(\"legalPromptVariantGChild\"),\n key: \"child\",\n },\n ],\n });\n}\n\nfunction showFindGuardianDialog() {\n return showDialog({\n container: document.body,\n dataTestId: \"find-guardian-dialog\",\n lang: supportedLocale,\n title: localizedString(\"legalPromptVariantGFindYourParent\"),\n buttons: [\n {\n text: localizedString(\"legalPromptVariantGIAmGuardian\"),\n key: \"guardian\",\n },\n {\n text: localizedString(\"legalPromptVariantGCancel\"),\n key: \"cancel\",\n isSecondary: true,\n },\n ],\n });\n}\n\nexport type LegalPromptFactory = (\n privacyPolicy: LegalDocument & { type: LegalDocument_Type.PRIVACY_POLICY },\n termsOfService: LegalDocument & { type: LegalDocument_Type.TERMS_OF_SERVICE },\n learnMore: LegalDocument & { type: LegalDocument_Type.LEARN_MORE },\n childrenProtectionActRestricted: boolean\n) => LegalPrompt;\n\nexport type LegalPrompt = {\n contentHash: string;\n show: () => Promise<boolean>;\n};\n\n/**\n * @internal\n */\nexport const legalPromptFactory = Injectable(\"legalPrompt\", (): LegalPromptFactory => {\n return function legalPrompt(\n privacyPolicy: LegalDocument & { type: LegalDocument_Type.PRIVACY_POLICY },\n termsOfService: LegalDocument & { type: LegalDocument_Type.TERMS_OF_SERVICE },\n learnMore: LegalDocument & { type: LegalDocument_Type.LEARN_MORE },\n childrenProtectionActRestricted: boolean\n ) {\n const legalMessage = childrenProtectionActRestricted\n ? localizedString(\"legalPromptVariantGMessage\")\n : localizedString(\"legalPromptMessage\")({\n privacyPolicyUrl: privacyPolicy.webUrl,\n termsOfServiceUrl: termsOfService.webUrl,\n learnMoreUrl: learnMore.webUrl,\n });\n const legalTitleText = localizedString(\"legalPromptTermsOfService\");\n const legalTitle = childrenProtectionActRestricted ? legalTitleText : snapIcon;\n\n return {\n contentHash: computeHash(legalMessage),\n\n async show() {\n if (!childrenProtectionActRestricted) {\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n }\n\n while (true) {\n const adultOrChild = await showAdultOrChildDialog();\n switch (adultOrChild) {\n case \"child\": {\n const findGuardian = await showFindGuardianDialog();\n switch (findGuardian) {\n case \"cancel\":\n continue;\n case \"guardian\":\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n case \"dismiss\":\n return false;\n default:\n assertUnreachable(findGuardian);\n }\n }\n case \"adult\":\n return showTosDialog(legalTitle, legalTitleText, legalMessage);\n case \"dismiss\":\n return false;\n default:\n assertUnreachable(adultOrChild);\n }\n }\n },\n };\n };\n});\n"]}
@@ -1,6 +1,6 @@
1
1
  import { defineAction, defineActions, defineState, defineStates, dispatch, forActions, inStates, StateMachine, } from "@snap/state-management";
2
2
  import { catchError, forkJoin, from, map, merge, of, switchMap } from "rxjs";
3
- import { Injectable } from "../dependency-injection/Injectable";
3
+ import { Injectable } from "@snap/ts-inject";
4
4
  import { LegalDocument, LegalDocument_Type, LegalPrompt as LegalPromptProto, } from "../generated-proto/pb_schema/camera_kit/v3/legal_prompt";
5
5
  import { getLogger } from "../logger/logger";
6
6
  import { ExpiringPersistence } from "../persistence/ExpiringPersistence";
@@ -1 +1 @@
1
- {"version":3,"file":"legalState.js","sourceRoot":"","sources":["../../src/legal/legalState.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,YAAY,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,WAAW,IAAI,gBAAgB,GAClC,MAAM,yDAAyD,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAErG,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAcvC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC1C,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AAEvD,MAAM,gBAAgB,GAAG,GAAG,E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AC,MAAM,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC,CAAC,CACL,CAAC;IACN,CAAC,CAAC,EACF,QAAQ,CAAC,UAAU,CAAC,CACvB;SACA,SAAS,CAAC;QACP,KAAK,EAAE,MAAM,CAAC,KAAK;KACtB,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACtB,CAAC,CACJ,CAAC","sourcesContent":["import {\n defineAction,\n defineActions,\n defineState,\n defineStates,\n dispatch,\n forActions,\n inStates,\n StateMachine,\n} from \"@snap/state-management\";\nimport { catchError, forkJoin, from, map, merge, of, switchMap } from \"rxjs\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport {\n LegalDocument,\n LegalDocument_Type,\n LegalPrompt as LegalPromptProto,\n} from \"../generated-proto/pb_schema/camera_kit/v3/legal_prompt\";\nimport type { ConfigResult } from \"../generated-proto/pb_schema/cdp/cof/config_result\";\nimport { getLogger } from \"../logger/logger\";\nimport { ExpiringPersistence } from \"../persistence/ExpiringPersistence\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport type { RemoteConfiguration } from \"../remote-configuration/remoteConfiguration\";\nimport { remoteConfigurationFactory } from \"../remote-configuration/remoteConfiguration\";\nimport { GetInitializationConfigResponse } from \"../generated-proto/pb_schema/camera_kit/v3/service\";\nimport type { LegalPromptFactory } from \"./legalPrompt\";\nimport { legalPromptFactory } from \"./legalPrompt\";\n\nconst logger = getLogger(\"LegalState\");\n\ntype SupportedDocumentType =\n | LegalDocument_Type.PRIVACY_POLICY\n | LegalDocument_Type.TERMS_OF_SERVICE\n | LegalDocument_Type.LEARN_MORE;\n\n/**\n * We store a hash of the last accepted ToS content. This is how we determine if the user previously accepted the\n * relevant ToS.\n *\n * ToS acceptance is only valid for 12 hours. That is, if legal status is checked and the last acceptance occurred more\n * than 12 hours ago, the user must be prompted to accept again.\n */\nconst tosContentHashExpiry = 12 * 60 * 60;\nconst tosContentHashKey = \"lastAcceptedTosContentHash\";\n\nconst createLegalState = () => {\n const states = defineStates(defineState(\"unknown\")(), defineState(\"accepted\")(), defineState(\"rejected\")());\n\n const actions = defineActions(\n defineAction(\"requestLegalPrompt\")(),\n defineAction(\"accept\")<string>(),\n defineAction(\"reject\")<string>()\n );\n\n return new StateMachine(actions, states, states.unknown(), (actions) => {\n return merge(\n actions.pipe(\n inStates(\"unknown\"),\n forActions(\"accept\"),\n map(() => states.accepted())\n ),\n actions.pipe(\n inStates(\"unknown\"),\n forActions(\"reject\"),\n map(() => states.rejected())\n ),\n\n // We don't treat \"rejected\" as a terminal state -- if we get another request to display the legal prompt,\n // even though we're in the rejected state, we'll transition back to unknown and the prompt will be shown.\n //\n // Conversely, we do treat \"accepted\" as a terminal state -- we will not transition back to unknown or\n // show the legal prompt if we're already in accepted state, even if we get a request to display the prompt.\n actions.pipe(\n inStates(\"rejected\"),\n forActions(\"requestLegalPrompt\"),\n map(() => states.unknown())\n )\n );\n });\n};\n\nconst defaultLegalDocumentDate = new Date(\"2021-09-30T00:00:00+00:00\");\nconst defaultLegalPrompt = LegalPromptProto.fromPartial({\n documents: [\n LegalDocument.fromPartial({\n type: LegalDocument_Type.PRIVACY_POLICY,\n webUrl: \"https://values.snap.com/privacy/privacy-policy\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n LegalDocument.fromPartial({\n type: LegalDocument_Type.TERMS_OF_SERVICE,\n webUrl: \"https://snap.com/terms\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n LegalDocument.fromPartial({\n type: LegalDocument_Type.LEARN_MORE,\n webUrl: \"https://support.snapchat.com/article/camera-information-use\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n ],\n // By default, we adopt a fail-open approach, which means that if COF fails,\n // we do not display ToS for the following reasons:\n // 1. It provides better experince for big partners with ToS disabled\n // 2. It has minimal risk\n disabled: true,\n});\n\nconst defaultInitConfig = GetInitializationConfigResponse.fromPartial({});\n\nconst hasAnyValue = (c: ConfigResult): c is ConfigResult & { value: { anyValue: { value: Uint8Array } } } => {\n return c.value?.anyValue?.value instanceof Uint8Array;\n};\n\nconst getDocumentOrDefault =\n (documents: LegalDocument[]) =>\n <T extends SupportedDocumentType>(type: T): LegalDocument & { type: T } => {\n return (documents.find((d) => d.type === type) ??\n defaultLegalPrompt.documents.find((d) => d.type === type)!) as LegalDocument & { type: T };\n };\n\nexport type LegalState = ReturnType<typeof createLegalState>;\n\n/**\n * We maintain the state of the user's acceptance of Snap's various legal documents. Other components may require that\n * the legal state be \"accepted\" before proceeding (e.g. to apply a lens).\n *\n * On page load, the legal state starts as \"unknown.\" If a request is made to determine the legal state, the following\n * business logic is implemented:\n *\n * 1. Download remote COF config value containing the legal documents + a `disabled` field to optionally skip the legal\n * requirement.\n * 2. Check for a `lastAcceptedTosContentHash` stored in IndexedDB.\n * 3. Prompt the user to accept/reject the legal documents.\n *\n * ┌────────────────────────────────────────────────────────┐\n * │ COF config value includes \"disabled: true\" │\n * └────────────────────────────────────────────────────────┘\n * │\n * │\n * ┌────────No────────────┴────────────Yes──────────────────┐\n * │ │\n * ▼ │\n * ┌────────────────────────────────────┐ ▼\n * │\"lastAcceptedTosContentHash\" exists │ ┌────────────┐\n * └────────────────────────────────────┘ │ Skip ToS │\n * │ └────────────┘\n * │ ▲\n * ┌─────────────No───┴───────Yes────────────┐ │\n * │ │ │\n * │ │ │\n * ▼ ▼ │\n * ┌────────────┐ ┌────────────────────────────────────────┐ │\n * │ Show ToS │ │ Hash of ToS content from COF matches │ │\n * └────────────┘ │ \"lastAcceptedTosContentHash\" │ │\n * ▲ └────────────────────────────────────────┘ │\n * │ │ │\n * │ │ │\n * └──────────────────No─────────────────────┴───────────────────Yes───────────┘\n *\n * @internal\n */\nexport const legalStateFactory = Injectable(\n \"legalState\",\n [remoteConfigurationFactory.token, legalPromptFactory.token] as const,\n (remoteConfig: RemoteConfiguration, legalPrompt: LegalPromptFactory): LegalState => {\n const persistance = new ExpiringPersistence<string>(\n () => tosContentHashExpiry,\n new IndexedDBPersistence({ databaseName: \"Legal\" })\n );\n const getLastAcceptedTosContentHash = () =>\n from(persistance.retrieve(tosContentHashKey).catch((error) => logger.warn(error)));\n\n const setLastAcceptedTosContentHash = (hash: string) =>\n persistance.store(tosContentHashKey, hash).catch((error) => logger.warn(error));\n\n const legalState = createLegalState();\n\n legalState.events\n .pipe(\n inStates(\"unknown\"),\n forActions(\"requestLegalPrompt\"),\n switchMap(() =>\n forkJoin({\n cofConfig: remoteConfig.get(\"CAMERA_KIT_LEGAL_PROMPT\").pipe(\n map((configResults) => {\n const config = configResults.find(hasAnyValue);\n if (!config) return defaultLegalPrompt;\n return LegalPromptProto.decode(config.value.anyValue.value);\n }),\n catchError((error) => {\n logger.error(error);\n return of(defaultLegalPrompt);\n })\n ),\n initConfig: remoteConfig.getInitializationConfig().pipe(\n catchError((error) => {\n logger.error(error);\n return of(defaultInitConfig);\n })\n ),\n })\n ),\n switchMap(({ cofConfig, initConfig }) => {\n // NOTE: Currently, we check two sources to determine whether ToS is disabled or not:\n // COF and initConfig. Legal document links are pulled only from COF (or defaults),\n // because initConfig has not been implemented yet. In the future, we may choose\n // to exclusively use initConfig, which could incorporate the COF call internally:\n // https://jira.sc-corp.net/browse/CAMKIT-4791\n\n if (initConfig.legalPrompt?.disabled) {\n return of(legalState.actions.accept(\"disabled\"));\n }\n\n if (cofConfig.disabled) {\n return of(legalState.actions.accept(\"disabled\"));\n }\n\n const documentOfType = getDocumentOrDefault(cofConfig.documents);\n const prompt = legalPrompt(\n documentOfType(LegalDocument_Type.PRIVACY_POLICY),\n documentOfType(LegalDocument_Type.TERMS_OF_SERVICE),\n documentOfType(LegalDocument_Type.LEARN_MORE),\n initConfig.childrenProtectionActRestricted\n );\n\n return getLastAcceptedTosContentHash().pipe(\n switchMap((lastAcceptedTosContentHash) => {\n if (prompt.contentHash === lastAcceptedTosContentHash) return of(true);\n\n // Delegate prompting the end-user to accept/reject the legal documents. This returns with\n // a Promise<boolean> indicating accept/reject.\n return prompt.show();\n }),\n map((didAccept) => {\n if (!didAccept) return legalState.actions.reject(prompt.contentHash);\n setLastAcceptedTosContentHash(prompt.contentHash);\n return legalState.actions.accept(prompt.contentHash);\n })\n );\n }),\n dispatch(legalState)\n )\n .subscribe({\n error: logger.error,\n });\n\n return legalState;\n }\n);\n"]}
1
+ {"version":3,"file":"legalState.js","sourceRoot":"","sources":["../../src/legal/legalState.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,YAAY,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACH,aAAa,EACb,kBAAkB,EAClB,WAAW,IAAI,gBAAgB,GAClC,MAAM,yDAAyD,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AAErG,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAcvC,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAC1C,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AAEvD,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC1B,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,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,CAAC,CAAC,EACF,QAAQ,CAAC,UAAU,CAAC,CACvB;SACA,SAAS,CAAC;QACP,KAAK,EAAE,MAAM,CAAC,KAAK;KACtB,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACtB,CAAC,CACJ,CAAC","sourcesContent":["import {\n defineAction,\n defineActions,\n defineState,\n defineStates,\n dispatch,\n forActions,\n inStates,\n StateMachine,\n} from \"@snap/state-management\";\nimport { catchError, forkJoin, from, map, merge, of, switchMap } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport {\n LegalDocument,\n LegalDocument_Type,\n LegalPrompt as LegalPromptProto,\n} from \"../generated-proto/pb_schema/camera_kit/v3/legal_prompt\";\nimport type { ConfigResult } from \"../generated-proto/pb_schema/cdp/cof/config_result\";\nimport { getLogger } from \"../logger/logger\";\nimport { ExpiringPersistence } from \"../persistence/ExpiringPersistence\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport type { RemoteConfiguration } from \"../remote-configuration/remoteConfiguration\";\nimport { remoteConfigurationFactory } from \"../remote-configuration/remoteConfiguration\";\nimport { GetInitializationConfigResponse } from \"../generated-proto/pb_schema/camera_kit/v3/service\";\nimport type { LegalPromptFactory } from \"./legalPrompt\";\nimport { legalPromptFactory } from \"./legalPrompt\";\n\nconst logger = getLogger(\"LegalState\");\n\ntype SupportedDocumentType =\n | LegalDocument_Type.PRIVACY_POLICY\n | LegalDocument_Type.TERMS_OF_SERVICE\n | LegalDocument_Type.LEARN_MORE;\n\n/**\n * We store a hash of the last accepted ToS content. This is how we determine if the user previously accepted the\n * relevant ToS.\n *\n * ToS acceptance is only valid for 12 hours. That is, if legal status is checked and the last acceptance occurred more\n * than 12 hours ago, the user must be prompted to accept again.\n */\nconst tosContentHashExpiry = 12 * 60 * 60;\nconst tosContentHashKey = \"lastAcceptedTosContentHash\";\n\nconst createLegalState = () => {\n const states = defineStates(defineState(\"unknown\")(), defineState(\"accepted\")(), defineState(\"rejected\")());\n\n const actions = defineActions(\n defineAction(\"requestLegalPrompt\")(),\n defineAction(\"accept\")<string>(),\n defineAction(\"reject\")<string>()\n );\n\n return new StateMachine(actions, states, states.unknown(), (actions) => {\n return merge(\n actions.pipe(\n inStates(\"unknown\"),\n forActions(\"accept\"),\n map(() => states.accepted())\n ),\n actions.pipe(\n inStates(\"unknown\"),\n forActions(\"reject\"),\n map(() => states.rejected())\n ),\n\n // We don't treat \"rejected\" as a terminal state -- if we get another request to display the legal prompt,\n // even though we're in the rejected state, we'll transition back to unknown and the prompt will be shown.\n //\n // Conversely, we do treat \"accepted\" as a terminal state -- we will not transition back to unknown or\n // show the legal prompt if we're already in accepted state, even if we get a request to display the prompt.\n actions.pipe(\n inStates(\"rejected\"),\n forActions(\"requestLegalPrompt\"),\n map(() => states.unknown())\n )\n );\n });\n};\n\nconst defaultLegalDocumentDate = new Date(\"2021-09-30T00:00:00+00:00\");\nconst defaultLegalPrompt = LegalPromptProto.fromPartial({\n documents: [\n LegalDocument.fromPartial({\n type: LegalDocument_Type.PRIVACY_POLICY,\n webUrl: \"https://values.snap.com/privacy/privacy-policy\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n LegalDocument.fromPartial({\n type: LegalDocument_Type.TERMS_OF_SERVICE,\n webUrl: \"https://snap.com/terms\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n LegalDocument.fromPartial({\n type: LegalDocument_Type.LEARN_MORE,\n webUrl: \"https://support.snapchat.com/article/camera-information-use\",\n version: \"1\",\n timestamp: defaultLegalDocumentDate,\n }),\n ],\n // By default, we adopt a fail-open approach, which means that if COF fails,\n // we do not display ToS for the following reasons:\n // 1. It provides better experince for big partners with ToS disabled\n // 2. It has minimal risk\n disabled: true,\n});\n\nconst defaultInitConfig = GetInitializationConfigResponse.fromPartial({});\n\nconst hasAnyValue = (c: ConfigResult): c is ConfigResult & { value: { anyValue: { value: Uint8Array } } } => {\n return c.value?.anyValue?.value instanceof Uint8Array;\n};\n\nconst getDocumentOrDefault =\n (documents: LegalDocument[]) =>\n <T extends SupportedDocumentType>(type: T): LegalDocument & { type: T } => {\n return (documents.find((d) => d.type === type) ??\n defaultLegalPrompt.documents.find((d) => d.type === type)!) as LegalDocument & { type: T };\n };\n\nexport type LegalState = ReturnType<typeof createLegalState>;\n\n/**\n * We maintain the state of the user's acceptance of Snap's various legal documents. Other components may require that\n * the legal state be \"accepted\" before proceeding (e.g. to apply a lens).\n *\n * On page load, the legal state starts as \"unknown.\" If a request is made to determine the legal state, the following\n * business logic is implemented:\n *\n * 1. Download remote COF config value containing the legal documents + a `disabled` field to optionally skip the legal\n * requirement.\n * 2. Check for a `lastAcceptedTosContentHash` stored in IndexedDB.\n * 3. Prompt the user to accept/reject the legal documents.\n *\n * ┌────────────────────────────────────────────────────────┐\n * │ COF config value includes \"disabled: true\" │\n * └────────────────────────────────────────────────────────┘\n * │\n * │\n * ┌────────No────────────┴────────────Yes──────────────────┐\n * │ │\n * ▼ │\n * ┌────────────────────────────────────┐ ▼\n * │\"lastAcceptedTosContentHash\" exists │ ┌────────────┐\n * └────────────────────────────────────┘ │ Skip ToS │\n * │ └────────────┘\n * │ ▲\n * ┌─────────────No───┴───────Yes────────────┐ │\n * │ │ │\n * │ │ │\n * ▼ ▼ │\n * ┌────────────┐ ┌────────────────────────────────────────┐ │\n * │ Show ToS │ │ Hash of ToS content from COF matches │ │\n * └────────────┘ │ \"lastAcceptedTosContentHash\" │ │\n * ▲ └────────────────────────────────────────┘ │\n * │ │ │\n * │ │ │\n * └──────────────────No─────────────────────┴───────────────────Yes───────────┘\n *\n * @internal\n */\nexport const legalStateFactory = Injectable(\n \"legalState\",\n [remoteConfigurationFactory.token, legalPromptFactory.token] as const,\n (remoteConfig: RemoteConfiguration, legalPrompt: LegalPromptFactory): LegalState => {\n const persistance = new ExpiringPersistence<string>(\n () => tosContentHashExpiry,\n new IndexedDBPersistence({ databaseName: \"Legal\" })\n );\n const getLastAcceptedTosContentHash = () =>\n from(persistance.retrieve(tosContentHashKey).catch((error) => logger.warn(error)));\n\n const setLastAcceptedTosContentHash = (hash: string) =>\n persistance.store(tosContentHashKey, hash).catch((error) => logger.warn(error));\n\n const legalState = createLegalState();\n\n legalState.events\n .pipe(\n inStates(\"unknown\"),\n forActions(\"requestLegalPrompt\"),\n switchMap(() =>\n forkJoin({\n cofConfig: remoteConfig.get(\"CAMERA_KIT_LEGAL_PROMPT\").pipe(\n map((configResults) => {\n const config = configResults.find(hasAnyValue);\n if (!config) return defaultLegalPrompt;\n return LegalPromptProto.decode(config.value.anyValue.value);\n }),\n catchError((error) => {\n logger.error(error);\n return of(defaultLegalPrompt);\n })\n ),\n initConfig: remoteConfig.getInitializationConfig().pipe(\n catchError((error) => {\n logger.error(error);\n return of(defaultInitConfig);\n })\n ),\n })\n ),\n switchMap(({ cofConfig, initConfig }) => {\n // NOTE: Currently, we check two sources to determine whether ToS is disabled or not:\n // COF and initConfig. Legal document links are pulled only from COF (or defaults),\n // because initConfig has not been implemented yet. In the future, we may choose\n // to exclusively use initConfig, which could incorporate the COF call internally:\n // https://jira.sc-corp.net/browse/CAMKIT-4791\n\n if (initConfig.legalPrompt?.disabled) {\n return of(legalState.actions.accept(\"disabled\"));\n }\n\n if (cofConfig.disabled) {\n return of(legalState.actions.accept(\"disabled\"));\n }\n\n const documentOfType = getDocumentOrDefault(cofConfig.documents);\n const prompt = legalPrompt(\n documentOfType(LegalDocument_Type.PRIVACY_POLICY),\n documentOfType(LegalDocument_Type.TERMS_OF_SERVICE),\n documentOfType(LegalDocument_Type.LEARN_MORE),\n initConfig.childrenProtectionActRestricted\n );\n\n return getLastAcceptedTosContentHash().pipe(\n switchMap((lastAcceptedTosContentHash) => {\n if (prompt.contentHash === lastAcceptedTosContentHash) return of(true);\n\n // Delegate prompting the end-user to accept/reject the legal documents. This returns with\n // a Promise<boolean> indicating accept/reject.\n return prompt.show();\n }),\n map((didAccept) => {\n if (!didAccept) return legalState.actions.reject(prompt.contentHash);\n setLastAcceptedTosContentHash(prompt.contentHash);\n return legalState.actions.accept(prompt.contentHash);\n })\n );\n }),\n dispatch(legalState)\n )\n .subscribe({\n error: logger.error,\n });\n\n return legalState;\n }\n);\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Injectable } from "../dependency-injection/Injectable";
2
+ import { Injectable } from "@snap/ts-inject";
3
3
  import { persistentStoreError } from "../namedErrors";
4
4
  import { getLogger } from "../logger/logger";
5
5
  import { IndexedDBPersistence } from "../persistence/IndexedDBPersistence";
@@ -1 +1 @@
1
- {"version":3,"file":"LensPersistenceStore.js","sourceRoot":"","sources":["../../src/lens/LensPersistenceStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAG7E,MAAM,MAAM,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CACjD,sBAAsB,EACtB,CAAC,eAAe,CAAC,KAAK,CAAU,EAChC,CAAC,QAAkB,EAAqC,EAAE;IACtD,MAAM,EAAE,GAAG,IAAI,oBAAoB,CAAc,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC3F,QAAQ,CAAC,mCAAmC,CAAC,CAAO,EAAE,EAAE,IAAI,EAAE,EAAE;QAC5D,IAAI;YACA,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SAC5B;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,8CAA8C,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SAClG;IACL,CAAC,CAAA,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACd,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"../dependency-injection/Injectable\";\nimport { persistentStoreError } from \"../namedErrors\";\nimport { getLogger } from \"../logger/logger\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport { lensCoreFactory } from \"../lens-core-module/loader/lensCoreFactory\";\nimport type { LensCore } from \"../lens-core-module/lensCore\";\n\nconst logger = getLogger(\"LensPersistenceStore\");\n\nexport const lensPersistenceStoreFactory = Injectable(\n \"lensPersistenceStore\",\n [lensCoreFactory.token] as const,\n (lensCore: LensCore): IndexedDBPersistence<ArrayBuffer> => {\n const db = new IndexedDBPersistence<ArrayBuffer>({ databaseName: \"lensPersistenceStore\" });\n lensCore.registerSavePersistentStoreCallback(async (id, data) => {\n try {\n await db.store(id, data);\n } catch (error) {\n logger.error(persistentStoreError(`Error occurred while storing data for lens ${id}.`, error));\n }\n });\n return db;\n }\n);\n"]}
1
+ {"version":3,"file":"LensPersistenceStore.js","sourceRoot":"","sources":["../../src/lens/LensPersistenceStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAG7E,MAAM,MAAM,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CACjD,sBAAsB,EACtB,CAAC,eAAe,CAAC,KAAK,CAAU,EAChC,CAAC,QAAkB,EAAqC,EAAE;IACtD,MAAM,EAAE,GAAG,IAAI,oBAAoB,CAAc,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC3F,QAAQ,CAAC,mCAAmC,CAAC,CAAO,EAAE,EAAE,IAAI,EAAE,EAAE;QAC5D,IAAI;YACA,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SAC5B;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,8CAA8C,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SAClG;IACL,CAAC,CAAA,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACd,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { persistentStoreError } from \"../namedErrors\";\nimport { getLogger } from \"../logger/logger\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport { lensCoreFactory } from \"../lens-core-module/loader/lensCoreFactory\";\nimport type { LensCore } from \"../lens-core-module/lensCore\";\n\nconst logger = getLogger(\"LensPersistenceStore\");\n\nexport const lensPersistenceStoreFactory = Injectable(\n \"lensPersistenceStore\",\n [lensCoreFactory.token] as const,\n (lensCore: LensCore): IndexedDBPersistence<ArrayBuffer> => {\n const db = new IndexedDBPersistence<ArrayBuffer>({ databaseName: \"lensPersistenceStore\" });\n lensCore.registerSavePersistentStoreCallback(async (id, data) => {\n try {\n await db.store(id, data);\n } catch (error) {\n logger.error(persistentStoreError(`Error occurred while storing data for lens ${id}.`, error));\n }\n });\n return db;\n }\n);\n"]}
@@ -1,7 +1,7 @@
1
1
  import { __awaiter, __esDecorate, __runInitializers } from "tslib";
2
+ import { Injectable } from "@snap/ts-inject";
2
3
  import { validate } from "../common/validate";
3
4
  import { isArrayOfType, isSafeString, isSafeStringArray, isString, isUndefined } from "../common/typeguards";
4
- import { Injectable } from "../dependency-injection/Injectable";
5
5
  import { defaultFetchHandlerFactory } from "../handlers/defaultFetchHandler";
6
6
  import { createRequestStateEmittingHandler, requestStateEventTargetFactory, } from "../handlers/requestStateEmittingHandler";
7
7
  import { HandlerChainBuilder } from "../handlers/HandlerChainBuilder";
@@ -1 +1 @@
1
- {"version":3,"file":"LensRepository.js","sourceRoot":"","sources":["../../src/lens/LensRepository.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EACH,iCAAiC,EACjC,8BAA8B,GACjC,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAQ3C,MAAM,cAAc,GAGhB;IACA,QAAQ,EAAE,mCAAmC,CAAC,QAAQ;IACtD,QAAQ,EAAE,mCAAmC,CAAC,SAAS;CAGS,CAAC;AAErE,SAAS,aAAa,CAAC,K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+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC;IAEpD,OAAO,IAAI,cAAc,CAAC,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;AAClF,CAAC,CACJ,CAAC","sourcesContent":["import { validate } from \"../common/validate\";\nimport { isArrayOfType, isSafeString, isSafeStringArray, isString, isUndefined } from \"../common/typeguards\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport type { FetchHandler } from \"../handlers/defaultFetchHandler\";\nimport { defaultFetchHandlerFactory } from \"../handlers/defaultFetchHandler\";\nimport type { RequestStateEventTarget } from \"../handlers/requestStateEmittingHandler\";\nimport {\n createRequestStateEmittingHandler,\n requestStateEventTargetFactory,\n} from \"../handlers/requestStateEmittingHandler\";\nimport type { LensDownloadDimensions } from \"../metrics/reporters/reportLensAndAssetDownload\";\nimport type { Handler } from \"../handlers/HandlerChainBuilder\";\nimport { HandlerChainBuilder } from \"../handlers/HandlerChainBuilder\";\nimport { createArrayBufferParsingHandler } from \"../handlers/arrayBufferParsingHandler\";\nimport { LensAssetManifestItem_RequestTiming } from \"../generated-proto/pb_schema/camera_kit/v3/lens\";\nimport { getLogger } from \"../logger/logger\";\nimport { errorLoggingDecorator } from \"../logger/errorLoggingDecorator\";\nimport { ensureError } from \"../common/errorHelpers\";\nimport { withRequestPriority } from \"../handlers/utils\";\nimport type { EnumToPublicStringLiteralMap, ExcludeKeys } from \"../common/types\";\nimport type { Lens, LensProtoWithGroupId } from \"./Lens\";\nimport { isLensArray, toPublicLens } from \"./Lens\";\nimport type { LensAssetRepository } from \"./assets/LensAssetRepository\";\nimport { lensAssetRepositoryFactory } from \"./assets/LensAssetRepository\";\nimport type { LensSource } from \"./LensSource\";\nimport { loadLensesFromSources, lensSourcesFactory } from \"./LensSource\";\n\nconst logger = getLogger(\"LensRepository\");\n\ntype LensFetchHandler = Handler<\n [RequestInfo, LensDownloadDimensions],\n [ArrayBuffer, Response],\n RequestInit | undefined\n>;\n\nconst assetTimingMap: ExcludeKeys<\n EnumToPublicStringLiteralMap<typeof LensAssetManifestItem_RequestTiming>,\n \"preloadUnset\" | \"unrecognized\"\n> = {\n required: LensAssetManifestItem_RequestTiming.REQUIRED,\n onDemand: LensAssetManifestItem_RequestTiming.ON_DEMAND,\n // NOTE: This rule helps keep the public-facing AssetTiming type consistent with the proto.\n // We prefer using a separate type for TypeDoc purposes.\n} satisfies Record<AssetTiming, LensAssetManifestItem_RequestTiming>;\n\nfunction isAssetTiming(value: unknown): value is AssetTiming {\n return isString(value) && assetTimingMap.hasOwnProperty(value);\n}\n\nfunction isAssetTimingArrayOrUndefined(value: unknown): value is undefined | AssetTiming[] {\n return isUndefined(value) || isArrayOfType(isAssetTiming, value);\n}\n\n/**\n * Lens assets are included in a manifest, and each will indicate when that asset will be used by the lens.\n *\n * Assets can have the following timing values:\n * - `required`: the lens will definitely request this asset immediately when the lens is applied.\n * - `onDemand`: the lens may request this asset at some time while the lens is applied.\n *\n * Depending on the use-case, an application may want to cache both required and onDemand assets for\n * a particular lens, or may decide to only cache required assets (or cache no assets).\n *\n * @category Lenses\n */\nexport type AssetTiming = \"required\" | \"onDemand\";\n\nexport interface LensBinary {\n lensBuffer: ArrayBuffer;\n lensChecksum: string;\n}\n\n/**\n * The LensRepository is used to query for lenses from specific lens groups, or for a lens with a specific ID.\n *\n * Lens groups are configured in the CameraKit Portal -- that's where you'll find lens group IDs and lens IDs.\n *\n * Lenses must be loaded by the LensRepository before they can be applied to a {@link CameraKitSession}.\n *\n * @example\n * ```ts\n * const cameraKit = await bootstrapCameraKit(options)\n * const session = await cameraKit.createSession()\n * const lens = await cameraKit.lensRepository.loadLens(lensId, groupId)\n * session.applyLens(lens)\n * ```\n *\n * @category Lenses\n */\nclass LensRepository {\n private readonly metadataCache = new Map<string, LensProtoWithGroupId>();\n private readonly binariesCache = new Map<string, ArrayBuffer>();\n\n /** @internal */\n constructor(\n private readonly lensFetchHandler: LensFetchHandler,\n private readonly lensSources: LensSource[],\n private readonly lensAssetRepository: LensAssetRepository\n ) {}\n\n /**\n * Retrieve a single Lens.\n *\n * @param lensId Desired Lens's unique ID. Can be found in the CameraKit Portal.\n * @param groupId The ID of a group containing the desired Lens. Can be found in the CameraKit Portal.\n * @returns Resolves with the desired Lens, or rejects if an error occurred (including a missing Lens).\n */\n @validate(isSafeString, isSafeString)\n @errorLoggingDecorator(logger)\n async loadLens(lensId: string, groupId: string): Promise<Lens> {\n const lens = (await loadLensesFromSources(this.lensSources, groupId, lensId))[0];\n if (!lens) {\n throw new Error(`Cannot load lens. No lens with id ${lensId} was found in lens group ${groupId}.`);\n }\n const lensWithGroup: LensProtoWithGroupId = { ...lens, groupId };\n this.metadataCache.set(lens.id, lensWithGroup);\n return toPublicLens(lensWithGroup);\n }\n\n /**\n * Retrieve the Lenses contained in a list of Lens Groups.\n *\n * This may result in multiple requests to retrieve Lens data (e.g. one per desired group). If any constituent\n * requests fail, those errors will be reported in the response – but the returned Promise will not be rejected. Any\n * Lenses which could be successfully retrieved will be available in the response.\n *\n * @param groupIds A list of Lens Group IDs. Can be found in the CameraKit Portal.\n * @returns Resolves with a flattened list of all lenses in the desired groups. If any errors occurred during the\n * query operation, these will be included in a separate list. If errors are present, the list of Lenses may not\n * contain all the Lenses from the desired groups.\n */\n @validate(isSafeStringArray)\n @errorLoggingDecorator(logger)\n async loadLensGroups(groupIds: string[]): Promise<{\n errors: Error[];\n lenses: Lens[];\n }> {\n const responses = await Promise.all(\n groupIds.map(async (groupId) => {\n try {\n return (await loadLensesFromSources(this.lensSources, groupId)).map((lens) => {\n const lensWithGroup = { ...lens, groupId };\n this.metadataCache.set(lens.id, lensWithGroup);\n return toPublicLens(lensWithGroup);\n });\n } catch (e) {\n const error = ensureError(e);\n logger.error(new Error(`Failed to load lens group ${groupId}.`, { cause: error }));\n return error;\n }\n })\n );\n\n return responses.reduce(\n (result, response) => {\n if (response instanceof Error) result.errors.push(response);\n else result.lenses.push(...response);\n return result;\n },\n { errors: [], lenses: [] } as { errors: Error[]; lenses: Lens[] }\n );\n }\n\n /**\n * Loads and caches lens content and dependencies to reduce latency when {@link CameraKitSession.applyLens} is later\n * called to apply the lens. This is an in-memory cache, it will not be persisted across page loads.\n *\n * This may useful if the application A) knows which lenses will be applied and B) has some opportunity to call\n * this method before a lens is applied. For example, if the user must perform some other actions before lenses\n * become active, this might be a good opportunity to cache lenses to improve applyLens latency.\n *\n * @example\n * ```ts\n * const lens = await cameraKit.lensRepository.loadLens(lensId, groupId)\n * await cameraKit.lensRepository.cacheLensContent([lens])\n *\n * // sometime later -- this call will use the cached lens content, making lens application faster.\n * await cameraKitSession.applyLens(lens)\n * ```\n *\n * @param lenses Array of lenses to cache in memory.\n * @param assetTimingsToCache Lenses specify certain required assets that are necessary for the lens to render, and\n * other assets which may be needed by the lens. By default this method will cache all of those assets, but this\n * behavior can be modified to only load the required assets, only the \"onDemand\" assets, or neither (by passing\n * an empty array).\n */\n @validate(isLensArray, isAssetTimingArrayOrUndefined)\n @errorLoggingDecorator(logger)\n async cacheLensContent(lenses: Lens[], assetTimingsToCache: AssetTiming[] = [\"required\", \"onDemand\"]) {\n const assetTimingsToLoad = assetTimingsToCache.map((timing) => assetTimingMap[timing]);\n await Promise.all(\n lenses.map(async (lens) => {\n try {\n const { lensBuffer } = await this.getLensContent(lens, true);\n // Safety: getLensContent() call above ensures metadata to exist\n const { content } = this.metadataCache.get(lens.id)!;\n this.binariesCache.set(lens.id, lensBuffer);\n await this.lensAssetRepository.cacheAssets(content!.assetManifest, lens, assetTimingsToLoad, true);\n } catch (error) {\n logger.warn(`Failed to cache lens ${lens.id}.`, error);\n }\n })\n );\n }\n\n /**\n * Returns loaded Lens metadata if available.\n */\n getLensMetadata(lensId: string): LensProtoWithGroupId | undefined {\n return this.metadataCache.get(lensId);\n }\n\n /**\n * Removes Lens content from the in-memory cache.\n */\n removeCachedLenses(lenses: Lens[]) {\n lenses.forEach((lens) => this.binariesCache.delete(lens.id));\n }\n\n /**\n * Fetches lens content and assets. This may come from the cache, otherwise network requests will be made.\n *\n * @internal\n *\n * @param lens Lens to fetch content for.\n * @param lowPriority Flag indicating if the fetch requests should be treated with lower priority,\n * leveraging browser capabilities to defer or deprioritize network traffic.\n */\n async getLensContent(lens: Lens, lowPriority: boolean = false): Promise<LensBinary> {\n const { content } = this.metadataCache.get(lens.id) ?? {};\n if (!content) {\n throw new Error(`Cannot find metadata for lens ${lens.id}.`);\n }\n\n const cachedLensBuffer = this.binariesCache.get(lens.id);\n if (cachedLensBuffer) {\n return {\n lensBuffer: cachedLensBuffer,\n lensChecksum: content.lnsSha256,\n };\n }\n\n const [lensBuffer] = await this.lensFetchHandler([\n // TODO: remove force-cache once https://jira.sc-corp.net/browse/CAMKIT-3671 is addressed\n new Request(content.lnsUrlBolt, withRequestPriority({ cache: \"force-cache\" }, lowPriority)),\n {\n requestType: \"lens_content\",\n lensId: lens.id,\n },\n ]);\n return { lensBuffer, lensChecksum: content.lnsSha256 };\n }\n}\n\n// NOTE: jest doesn't like default exports of classes with decorated methods.\nexport { LensRepository };\n\n/**\n * @internal\n */\nexport const lensRepositoryFactory = Injectable(\n \"LensRepository\",\n [\n requestStateEventTargetFactory.token,\n defaultFetchHandlerFactory.token,\n lensSourcesFactory.token,\n lensAssetRepositoryFactory.token,\n ] as const,\n (\n requestStateEventTarget: RequestStateEventTarget,\n defaultFetchHandler: FetchHandler,\n lensSources: LensSource[],\n lensAssetRepository: LensAssetRepository\n ) => {\n const lensFetchHandler = new HandlerChainBuilder(defaultFetchHandler)\n .map(createRequestStateEmittingHandler<LensDownloadDimensions>(requestStateEventTarget))\n .map(createArrayBufferParsingHandler()).handler;\n\n return new LensRepository(lensFetchHandler, lensSources, lensAssetRepository);\n }\n);\n"]}
1
+ {"version":3,"file":"LensRepository.js","sourceRoot":"","sources":["../../src/lens/LensRepository.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,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C,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,WAAW,CAAC,CAAC;wBAC3F;4BACI,WAAW,EAAE,cAAc;4BAC3B,MAAM,EAAE,IAAI,CAAC,EAAE;yBAClB;qBACJ,CAAC,CAAC;oBACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;;aAC1D;;;oCAhJA,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC,EACpC,qBAAqB,CAAC,MAAM,CAAC;0CAuB7B,QAAQ,CAAC,iBAAiB,CAAC,EAC3B,qBAAqB,CAAC,MAAM,CAAC;4CAsD7B,QAAQ,CAAC,WAAW,EAAE,6BAA6B,CAAC,EACpD,qBAAqB,CAAC,MAAM,CAAC;YA9E9B,yKAAM,QAAQ,wCAQb;YAgBD,2LAAM,cAAc,wCA4BnB;YA2BD,iMAAM,gBAAgB,wCAerB;;;;AAoDL,OAAO,EAAE,cAAc,EAAE,CAAC;AAK1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAC3C,gBAAgB,EAChB;IACI,8BAA8B,CAAC,KAAK;IACpC,0BAA0B,CAAC,KAAK;IAChC,kBAAkB,CAAC,KAAK;IACxB,0BAA0B,CAAC,KAAK;CAC1B,EACV,CACI,uBAAgD,EAChD,mBAAiC,EACjC,WAAyB,EACzB,mBAAwC,EAC1C,EAAE;IACA,MAAM,gBAAgB,GAAG,IAAI,mBAAmB,CAAC,mBAAmB,CAAC;SAChE,GAAG,CAAC,iCAAiC,CAAyB,uBAAuB,CAAC,CAAC;SACvF,GAAG,CAAC,+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC;IAEpD,OAAO,IAAI,cAAc,CAAC,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;AAClF,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { validate } from \"../common/validate\";\nimport { isArrayOfType, isSafeString, isSafeStringArray, isString, isUndefined } from \"../common/typeguards\";\nimport type { FetchHandler } from \"../handlers/defaultFetchHandler\";\nimport { defaultFetchHandlerFactory } from \"../handlers/defaultFetchHandler\";\nimport type { RequestStateEventTarget } from \"../handlers/requestStateEmittingHandler\";\nimport {\n createRequestStateEmittingHandler,\n requestStateEventTargetFactory,\n} from \"../handlers/requestStateEmittingHandler\";\nimport type { LensDownloadDimensions } from \"../metrics/reporters/reportLensAndAssetDownload\";\nimport type { Handler } from \"../handlers/HandlerChainBuilder\";\nimport { HandlerChainBuilder } from \"../handlers/HandlerChainBuilder\";\nimport { createArrayBufferParsingHandler } from \"../handlers/arrayBufferParsingHandler\";\nimport { LensAssetManifestItem_RequestTiming } from \"../generated-proto/pb_schema/camera_kit/v3/lens\";\nimport { getLogger } from \"../logger/logger\";\nimport { errorLoggingDecorator } from \"../logger/errorLoggingDecorator\";\nimport { ensureError } from \"../common/errorHelpers\";\nimport { withRequestPriority } from \"../handlers/utils\";\nimport type { EnumToPublicStringLiteralMap, ExcludeKeys } from \"../common/types\";\nimport type { Lens, LensProtoWithGroupId } from \"./Lens\";\nimport { isLensArray, toPublicLens } from \"./Lens\";\nimport type { LensAssetRepository } from \"./assets/LensAssetRepository\";\nimport { lensAssetRepositoryFactory } from \"./assets/LensAssetRepository\";\nimport type { LensSource } from \"./LensSource\";\nimport { loadLensesFromSources, lensSourcesFactory } from \"./LensSource\";\n\nconst logger = getLogger(\"LensRepository\");\n\ntype LensFetchHandler = Handler<\n [RequestInfo, LensDownloadDimensions],\n [ArrayBuffer, Response],\n RequestInit | undefined\n>;\n\nconst assetTimingMap: ExcludeKeys<\n EnumToPublicStringLiteralMap<typeof LensAssetManifestItem_RequestTiming>,\n \"preloadUnset\" | \"unrecognized\"\n> = {\n required: LensAssetManifestItem_RequestTiming.REQUIRED,\n onDemand: LensAssetManifestItem_RequestTiming.ON_DEMAND,\n // NOTE: This rule helps keep the public-facing AssetTiming type consistent with the proto.\n // We prefer using a separate type for TypeDoc purposes.\n} satisfies Record<AssetTiming, LensAssetManifestItem_RequestTiming>;\n\nfunction isAssetTiming(value: unknown): value is AssetTiming {\n return isString(value) && assetTimingMap.hasOwnProperty(value);\n}\n\nfunction isAssetTimingArrayOrUndefined(value: unknown): value is undefined | AssetTiming[] {\n return isUndefined(value) || isArrayOfType(isAssetTiming, value);\n}\n\n/**\n * Lens assets are included in a manifest, and each will indicate when that asset will be used by the lens.\n *\n * Assets can have the following timing values:\n * - `required`: the lens will definitely request this asset immediately when the lens is applied.\n * - `onDemand`: the lens may request this asset at some time while the lens is applied.\n *\n * Depending on the use-case, an application may want to cache both required and onDemand assets for\n * a particular lens, or may decide to only cache required assets (or cache no assets).\n *\n * @category Lenses\n */\nexport type AssetTiming = \"required\" | \"onDemand\";\n\nexport interface LensBinary {\n lensBuffer: ArrayBuffer;\n lensChecksum: string;\n}\n\n/**\n * The LensRepository is used to query for lenses from specific lens groups, or for a lens with a specific ID.\n *\n * Lens groups are configured in the CameraKit Portal -- that's where you'll find lens group IDs and lens IDs.\n *\n * Lenses must be loaded by the LensRepository before they can be applied to a {@link CameraKitSession}.\n *\n * @example\n * ```ts\n * const cameraKit = await bootstrapCameraKit(options)\n * const session = await cameraKit.createSession()\n * const lens = await cameraKit.lensRepository.loadLens(lensId, groupId)\n * session.applyLens(lens)\n * ```\n *\n * @category Lenses\n */\nclass LensRepository {\n private readonly metadataCache = new Map<string, LensProtoWithGroupId>();\n private readonly binariesCache = new Map<string, ArrayBuffer>();\n\n /** @internal */\n constructor(\n private readonly lensFetchHandler: LensFetchHandler,\n private readonly lensSources: LensSource[],\n private readonly lensAssetRepository: LensAssetRepository\n ) {}\n\n /**\n * Retrieve a single Lens.\n *\n * @param lensId Desired Lens's unique ID. Can be found in the CameraKit Portal.\n * @param groupId The ID of a group containing the desired Lens. Can be found in the CameraKit Portal.\n * @returns Resolves with the desired Lens, or rejects if an error occurred (including a missing Lens).\n */\n @validate(isSafeString, isSafeString)\n @errorLoggingDecorator(logger)\n async loadLens(lensId: string, groupId: string): Promise<Lens> {\n const lens = (await loadLensesFromSources(this.lensSources, groupId, lensId))[0];\n if (!lens) {\n throw new Error(`Cannot load lens. No lens with id ${lensId} was found in lens group ${groupId}.`);\n }\n const lensWithGroup: LensProtoWithGroupId = { ...lens, groupId };\n this.metadataCache.set(lens.id, lensWithGroup);\n return toPublicLens(lensWithGroup);\n }\n\n /**\n * Retrieve the Lenses contained in a list of Lens Groups.\n *\n * This may result in multiple requests to retrieve Lens data (e.g. one per desired group). If any constituent\n * requests fail, those errors will be reported in the response – but the returned Promise will not be rejected. Any\n * Lenses which could be successfully retrieved will be available in the response.\n *\n * @param groupIds A list of Lens Group IDs. Can be found in the CameraKit Portal.\n * @returns Resolves with a flattened list of all lenses in the desired groups. If any errors occurred during the\n * query operation, these will be included in a separate list. If errors are present, the list of Lenses may not\n * contain all the Lenses from the desired groups.\n */\n @validate(isSafeStringArray)\n @errorLoggingDecorator(logger)\n async loadLensGroups(groupIds: string[]): Promise<{\n errors: Error[];\n lenses: Lens[];\n }> {\n const responses = await Promise.all(\n groupIds.map(async (groupId) => {\n try {\n return (await loadLensesFromSources(this.lensSources, groupId)).map((lens) => {\n const lensWithGroup = { ...lens, groupId };\n this.metadataCache.set(lens.id, lensWithGroup);\n return toPublicLens(lensWithGroup);\n });\n } catch (e) {\n const error = ensureError(e);\n logger.error(new Error(`Failed to load lens group ${groupId}.`, { cause: error }));\n return error;\n }\n })\n );\n\n return responses.reduce(\n (result, response) => {\n if (response instanceof Error) result.errors.push(response);\n else result.lenses.push(...response);\n return result;\n },\n { errors: [], lenses: [] } as { errors: Error[]; lenses: Lens[] }\n );\n }\n\n /**\n * Loads and caches lens content and dependencies to reduce latency when {@link CameraKitSession.applyLens} is later\n * called to apply the lens. This is an in-memory cache, it will not be persisted across page loads.\n *\n * This may useful if the application A) knows which lenses will be applied and B) has some opportunity to call\n * this method before a lens is applied. For example, if the user must perform some other actions before lenses\n * become active, this might be a good opportunity to cache lenses to improve applyLens latency.\n *\n * @example\n * ```ts\n * const lens = await cameraKit.lensRepository.loadLens(lensId, groupId)\n * await cameraKit.lensRepository.cacheLensContent([lens])\n *\n * // sometime later -- this call will use the cached lens content, making lens application faster.\n * await cameraKitSession.applyLens(lens)\n * ```\n *\n * @param lenses Array of lenses to cache in memory.\n * @param assetTimingsToCache Lenses specify certain required assets that are necessary for the lens to render, and\n * other assets which may be needed by the lens. By default this method will cache all of those assets, but this\n * behavior can be modified to only load the required assets, only the \"onDemand\" assets, or neither (by passing\n * an empty array).\n */\n @validate(isLensArray, isAssetTimingArrayOrUndefined)\n @errorLoggingDecorator(logger)\n async cacheLensContent(lenses: Lens[], assetTimingsToCache: AssetTiming[] = [\"required\", \"onDemand\"]) {\n const assetTimingsToLoad = assetTimingsToCache.map((timing) => assetTimingMap[timing]);\n await Promise.all(\n lenses.map(async (lens) => {\n try {\n const { lensBuffer } = await this.getLensContent(lens, true);\n // Safety: getLensContent() call above ensures metadata to exist\n const { content } = this.metadataCache.get(lens.id)!;\n this.binariesCache.set(lens.id, lensBuffer);\n await this.lensAssetRepository.cacheAssets(content!.assetManifest, lens, assetTimingsToLoad, true);\n } catch (error) {\n logger.warn(`Failed to cache lens ${lens.id}.`, error);\n }\n })\n );\n }\n\n /**\n * Returns loaded Lens metadata if available.\n */\n getLensMetadata(lensId: string): LensProtoWithGroupId | undefined {\n return this.metadataCache.get(lensId);\n }\n\n /**\n * Removes Lens content from the in-memory cache.\n */\n removeCachedLenses(lenses: Lens[]) {\n lenses.forEach((lens) => this.binariesCache.delete(lens.id));\n }\n\n /**\n * Fetches lens content and assets. This may come from the cache, otherwise network requests will be made.\n *\n * @internal\n *\n * @param lens Lens to fetch content for.\n * @param lowPriority Flag indicating if the fetch requests should be treated with lower priority,\n * leveraging browser capabilities to defer or deprioritize network traffic.\n */\n async getLensContent(lens: Lens, lowPriority: boolean = false): Promise<LensBinary> {\n const { content } = this.metadataCache.get(lens.id) ?? {};\n if (!content) {\n throw new Error(`Cannot find metadata for lens ${lens.id}.`);\n }\n\n const cachedLensBuffer = this.binariesCache.get(lens.id);\n if (cachedLensBuffer) {\n return {\n lensBuffer: cachedLensBuffer,\n lensChecksum: content.lnsSha256,\n };\n }\n\n const [lensBuffer] = await this.lensFetchHandler([\n // TODO: remove force-cache once https://jira.sc-corp.net/browse/CAMKIT-3671 is addressed\n new Request(content.lnsUrlBolt, withRequestPriority({ cache: \"force-cache\" }, lowPriority)),\n {\n requestType: \"lens_content\",\n lensId: lens.id,\n },\n ]);\n return { lensBuffer, lensChecksum: content.lnsSha256 };\n }\n}\n\n// NOTE: jest doesn't like default exports of classes with decorated methods.\nexport { LensRepository };\n\n/**\n * @internal\n */\nexport const lensRepositoryFactory = Injectable(\n \"LensRepository\",\n [\n requestStateEventTargetFactory.token,\n defaultFetchHandlerFactory.token,\n lensSourcesFactory.token,\n lensAssetRepositoryFactory.token,\n ] as const,\n (\n requestStateEventTarget: RequestStateEventTarget,\n defaultFetchHandler: FetchHandler,\n lensSources: LensSource[],\n lensAssetRepository: LensAssetRepository\n ) => {\n const lensFetchHandler = new HandlerChainBuilder(defaultFetchHandler)\n .map(createRequestStateEmittingHandler<LensDownloadDimensions>(requestStateEventTarget))\n .map(createArrayBufferParsingHandler()).handler;\n\n return new LensRepository(lensFetchHandler, lensSources, lensAssetRepository);\n }\n);\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { Injectable } from "../dependency-injection/Injectable";
2
+ import { Injectable } from "@snap/ts-inject";
3
3
  import { Envelope } from "../generated-proto/pb_schema/camera_kit/v3/export";
4
4
  export const lensSourcesFactory = Injectable("lensSources", () => []);
5
5
  export function loadLensesFromSources(sources, groupId, lensId) {