summaryrefslogtreecommitdiff
path: root/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/jet/intents/static-message-pages/win-back-page-intent-controller.ts')
-rw-r--r--src/jet/intents/static-message-pages/win-back-page-intent-controller.ts49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts b/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts
new file mode 100644
index 0000000..2b78ba0
--- /dev/null
+++ b/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts
@@ -0,0 +1,49 @@
+import type { IntentController } from '@jet/environment/dispatching';
+import type { RouteProvider } from '@jet/environment/routing';
+import type { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph';
+import { withActiveIntent } from '@jet-app/app-store/foundation/dependencies/active-intent';
+import { generateRoutes } from '@jet-app/app-store/common/util/generate-routes';
+import { injectWebNavigation } from '@jet-app/app-store/common/web-navigation/inject-web-navigation';
+
+import { StaticMessagePage } from '~/jet/models/static-message-page';
+
+const { routes, makeCanonicalUrl } = generateRoutes(
+ (opts) => ({
+ ...opts,
+ $kind: 'WinBackPageIntent',
+ }),
+ '/win-back/{offerId}',
+ [],
+ {
+ extraRules: [
+ {
+ regex: [/(?:\/[a-z]{2})?\/win-back/],
+ },
+ ],
+ },
+);
+
+export const WinBackPageIntentController: IntentController<any> &
+ RouteProvider = {
+ $intentKind: 'WinBackPageIntent',
+
+ routes,
+
+ async perform(intent, objectGraphWithoutActiveIntent: AppStoreObjectGraph) {
+ return await withActiveIntent(
+ objectGraphWithoutActiveIntent,
+ intent,
+ async (objectGraph) => {
+ const page = new StaticMessagePage({
+ titleLocKey: 'ASE.Web.AppStore.WinBack.Title',
+ contentType: 'win-back',
+ });
+
+ page.canonicalURL = makeCanonicalUrl(objectGraph, intent);
+
+ injectWebNavigation(objectGraph, page, intent.platform);
+ return page;
+ },
+ );
+ },
+};