Skip to content

Commit

Permalink
feat(RESP-1781): Remove support for CUI (#613)
Browse files Browse the repository at this point in the history
* feat(RESP-1781): Remove support for CUI

BREAKING CHANGE: CUI is not supported anymore

* chore(RESP-1781): Update tsconfig to match standards

* chore(RESP-1781): Update typeform eslint config to latest
  • Loading branch information
robespmun authored Sep 14, 2023
1 parent 5c5b127 commit 00f3a89
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 150 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@testing-library/dom": "^7.29.6",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.6",
"@typeform/eslint-config": "^6.0.2",
"@typeform/eslint-config": "^6.0.3",
"@types/cypress": "^1.1.3",
"@types/jest": "^26.0.20",
"@types/react": "^16.8.1",
Expand Down
81 changes: 0 additions & 81 deletions packages/demo-html/public/chat.html

This file was deleted.

2 changes: 2 additions & 0 deletions packages/embed-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"moduleResolution": "node",
"sourceMap": true,
"jsx": "react",
"allowUnreachableCode": false,
"noImplicitAny": true,
"keyofStringsOnly": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
Expand Down
27 changes: 0 additions & 27 deletions packages/embed/e2e/spec/functional/chat.cy.ts

This file was deleted.

23 changes: 0 additions & 23 deletions packages/embed/e2e/spec/visual/chat.cy.ts

This file was deleted.

2 changes: 2 additions & 0 deletions packages/embed/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"allowUnreachableCode": false,
"noImplicitAny": true,
"noEmit": true,
"types": ["cypress"]
},
Expand Down
7 changes: 0 additions & 7 deletions packages/embed/src/base/base-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ export type BaseOptions = {
*/
hidden?: Record<string, string>

/**
* Display embedded typeform as conversation
*
* @type {boolean}
*/
chat?: boolean

/**
* Reopen the modal window with form in the same state as it wos when closed.
* For widget this applies only on mobile (without displayOnMobile option).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe('build-options-from-attributes', () => {
data-tf-open="exit"
data-tf-open-value="3000"
data-tf-hidden="foo=foo value,bar=some bar value"
data-tf-chat
data-tf-share-ga-instance="ua-hello-1"
data-tf-tracking="utm_foo=utm foo value,foobar=foobar value"
data-tf-redirect-target="_blank"
Expand Down Expand Up @@ -64,7 +63,6 @@ describe('build-options-from-attributes', () => {
foo: 'foo value',
bar: 'some bar value',
},
chat: true,
shareGaInstance: 'ua-hello-1',
tracking: {
utm_foo: 'utm foo value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const buildOptionsFromAttributes = (element: HTMLElement) => {
onEndingButtonClick: 'function',
transitiveSearchParams: 'arrayOrBoolean',
hidden: 'record',
chat: 'boolean',
buttonColor: 'string',
customIcon: 'string',
width: 'integer',
Expand Down
7 changes: 3 additions & 4 deletions packages/embed/src/utils/build-iframe-src.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,19 @@ const mapOptionsToQueryParams = (
return { ...params, ...transitiveParams, ...tracking }
}

const getBaseUrl = (formString: string, domain = DEFAULT_DOMAIN, chat = false): URL => {
const getBaseUrl = (formString: string, domain = DEFAULT_DOMAIN): URL => {
if (formString.startsWith('http://') || formString.startsWith('https://')) {
return new URL(formString)
}

const prefix = chat ? 'c' : 'to'
return new URL(`https://${domain}/${prefix}/${formString}`)
return new URL(`https://${domain}/to/${formString}`)
}

export const buildIframeSrc = (params: BuildIframeSrcOptions): string => {
const { domain, formId, type, embedId, options } = params
const queryParams = mapOptionsToQueryParams(type, embedId, addDefaultUrlOptions(options))

const url = getBaseUrl(formId, domain, options.chat)
const url = getBaseUrl(formId, domain)

Object.entries(queryParams)
.filter(([, paramValue]) => isDefined(paramValue))
Expand Down
2 changes: 2 additions & 0 deletions packages/embed/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"lib": ["esnext", "dom", "dom.iterable"],
"moduleResolution": "node",
"jsx": "react",
"allowUnreachableCode": false,
"noImplicitAny": true,
"keyofStringsOnly": true,
"suppressImplicitAnyIndexErrors": true,
"experimentalDecorators": true,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3260,10 +3260,10 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==

"@typeform/eslint-config@^6.0.2":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@typeform/eslint-config/-/eslint-config-6.0.2.tgz#68007909d7ca7d65fea2d342f7bf1c4ee97ecd8a"
integrity sha512-2DvNxg3KGi169OudWUGKK2QlItrZlQNomopdbVkYC032BGSHlTyA77ZwrX3sfy6WsQuisT6ovlg/2sjVoA+fyw==
"@typeform/eslint-config@^6.0.3":
version "6.0.3"
resolved "https://registry.yarnpkg.com/@typeform/eslint-config/-/eslint-config-6.0.3.tgz#72984805a186261f6cf1d43d9eee380934310941"
integrity sha512-3KpGk4Q3hfbBO3syMXkXOicx/kaEYtTJ8DG9wt85k/7zqcdnuFGggHokB3Szb8uGyWjlLIt3WqpHZHnrtAhm4A==
dependencies:
"@typescript-eslint/eslint-plugin" "^5.44.0"
"@typescript-eslint/parser" "^5.44.0"
Expand Down

0 comments on commit 00f3a89

Please sign in to comment.