@bikdotai/bik-widgets 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.
- package/.eslintrc +22 -0
- package/.eslintrc.js +19 -0
- package/.github/workflows/main.yml +293 -0
- package/.prettierignore +13 -0
- package/.prettierrc +10 -0
- package/README.md +128 -0
- package/cypress/apiHelper/endpoints.ts +21 -0
- package/cypress/apiHelper/executor.ts +42 -0
- package/cypress/e2e/bottomDrawer.cy.ts +49 -0
- package/cypress/e2e/directReward.cy.ts +67 -0
- package/cypress/e2e/scratchTheCard.cy.ts +68 -0
- package/cypress/e2e/stw.cy.ts +82 -0
- package/cypress/e2e/waRedirection.cy.ts +46 -0
- package/cypress/fixtures/payloads.ts +330 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/e2e.ts +20 -0
- package/cypress.staging.config.ts +23 -0
- package/jsconfig.json +6 -0
- package/localtest.sh +10 -0
- package/log-server.js +86 -0
- package/package.json +79 -0
- package/postcss.config.js +8 -0
- package/src/Globals.d.ts +2 -0
- package/src/assets/lottie/santa.json +11722 -0
- package/src/assets/svg/CalendarClockIcon.tsx +30 -0
- package/src/assets/svg/CalendarIcon.tsx +24 -0
- package/src/assets/svg/CheckIcon.tsx +17 -0
- package/src/assets/svg/ChevronIcon.tsx +21 -0
- package/src/assets/svg/Close.tsx +39 -0
- package/src/assets/svg/Confetti.tsx +140 -0
- package/src/assets/svg/Copy.tsx +26 -0
- package/src/assets/svg/DropdownCheckIcon.tsx +35 -0
- package/src/assets/svg/ErrorIcon.tsx +27 -0
- package/src/assets/svg/RadioIcon.tsx +25 -0
- package/src/assets/svg/UncheckedCheckboxIcon.tsx +28 -0
- package/src/assets/svg/UncheckedRadioIcon.tsx +26 -0
- package/src/assets/svg/info.tsx +30 -0
- package/src/assets/svg/qrcode.svg +14 -0
- package/src/bootstrap.tsx +8 -0
- package/src/components/CtaCard/index.tsx +37 -0
- package/src/components/CtaCard/preview.module.css +32 -0
- package/src/components/CtaCard/style.module.css +32 -0
- package/src/components/EmailInput/emailInputBox.tsx +95 -0
- package/src/components/Fab/index.tsx +224 -0
- package/src/components/Fab/preview.module.css +28 -0
- package/src/components/Fab/style.module.css +37 -0
- package/src/components/Icons/Call.tsx +26 -0
- package/src/components/Icons/Cross.tsx +24 -0
- package/src/components/Icons/Gmail.tsx +61 -0
- package/src/components/Icons/Instagram.tsx +60 -0
- package/src/components/Icons/LiveChat.tsx +43 -0
- package/src/components/Icons/Messenger.tsx +57 -0
- package/src/components/Icons/Send.tsx +22 -0
- package/src/components/Icons/Whatsapp.tsx +24 -0
- package/src/components/Shimmer/index.tsx +12 -0
- package/src/components/Shimmer/style.module.css +37 -0
- package/src/components/SmsInput/smsInputBox.tsx +135 -0
- package/src/components/UserDetailsV2/userDetailsV2.desktop.module.css +52 -0
- package/src/components/UserDetailsV2/userDetailsV2.mobile.module.css +52 -0
- package/src/components/UserDetailsV2/userDetailsV2.module.css +81 -0
- package/src/components/UserDetailsV2/userDetailsV2.tsx +527 -0
- package/src/components/WhatsappInput/Spinner.tsx +26 -0
- package/src/components/WhatsappInput/whatsappInput.module.css +106 -0
- package/src/components/WhatsappInput/whatsappInputBox.tsx +155 -0
- package/src/components/WhatsappInput/whatsappInputPreviewDesktop.module.css +71 -0
- package/src/components/WhatsappInput/whatsappInputPreviewMobile.module.css +65 -0
- package/src/components/checkbox/checkbox.module.css +19 -0
- package/src/components/checkbox/checkbox.tsx +88 -0
- package/src/components/countryCodePicker/countriesDropdown.module.css +77 -0
- package/src/components/countryCodePicker/countriesDropdown.tsx +81 -0
- package/src/components/couponDetails/coupon.module.css +208 -0
- package/src/components/couponDetails/coupon.tsx +210 -0
- package/src/components/couponDetails/couponPreviewDesktop.module.css +158 -0
- package/src/components/couponDetails/couponPreviewMobile.module.css +164 -0
- package/src/components/index.ts +3 -0
- package/src/components/inputComponents/Checkbox.module.css +197 -0
- package/src/components/inputComponents/Checkbox.tsx +85 -0
- package/src/components/inputComponents/DatePicker.module.css +565 -0
- package/src/components/inputComponents/DatePicker.tsx +278 -0
- package/src/components/inputComponents/Dropdown.module.css +796 -0
- package/src/components/inputComponents/Dropdown.tsx +630 -0
- package/src/components/inputComponents/InputBox.module.css +401 -0
- package/src/components/inputComponents/InputBox.tsx +209 -0
- package/src/components/selectedCountry/selectedCountry.module.css +76 -0
- package/src/components/selectedCountry/selectedCountry.tsx +76 -0
- package/src/components/selectedCountry/selectedCountryPreviewDesktop.module.css +56 -0
- package/src/components/selectedCountry/selectedCountryPreviewMobile.module.css +57 -0
- package/src/components/userDetailsForm/RenderCustomFields.tsx +333 -0
- package/src/components/userDetailsForm/userDetailsForm.tsx +675 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useExitIntent.ts +452 -0
- package/src/hooks/useIsMobile.tsx +21 -0
- package/src/hooks/useMessageEvent.ts +8 -0
- package/src/hooks/useTriggeredIntentDetails.ts +43 -0
- package/src/hooks/useUrlListerner.ts +30 -0
- package/src/hooks/useWebSocketLogger.ts +59 -0
- package/src/hooks/useWindowEvent.ts +8 -0
- package/src/icons/copyIcon.tsx +26 -0
- package/src/icons/crossIconDesktop.tsx +20 -0
- package/src/icons/crossIconMobile.tsx +20 -0
- package/src/index.html +30 -0
- package/src/index.ts +32 -0
- package/src/index.tsx +1 -0
- package/src/repo/widgetRepo.ts +21 -0
- package/src/types/customFields.ts +73 -0
- package/src/utilities/cookie.ts +70 -0
- package/src/utilities/customFieldTypeMapping.ts +67 -0
- package/src/utilities/customFieldValidation.ts +201 -0
- package/src/utilities/encryption.ts +21 -0
- package/src/utilities/exitIntentUtils.ts +31 -0
- package/src/utilities/global.css +11 -0
- package/src/utilities/languageUtilities.ts +235 -0
- package/src/utilities/localRunner.js +26 -0
- package/src/utilities/localRunner.ts +27 -0
- package/src/utilities/localStorage.ts +40 -0
- package/src/utilities/script.tsx +15 -0
- package/src/utilities/stringUtils.ts +5 -0
- package/src/utilities/styleUtils.ts +134 -0
- package/src/utilities/variables.ts +11 -0
- package/src/utilities/widgetUtils.js +342 -0
- package/src/utilities/widgetUtils.ts +313 -0
- package/src/widgets/BottomDrawer/config.ts +41 -0
- package/src/widgets/BottomDrawer/index.tsx +116 -0
- package/src/widgets/BottomDrawer/modal.tsx +286 -0
- package/src/widgets/BottomDrawer/preview.module.css +122 -0
- package/src/widgets/BottomDrawer/previewMobile.module.css +124 -0
- package/src/widgets/BottomDrawer/style.module.css +279 -0
- package/src/widgets/CaptivateBanner/captivateBanner.tsx +200 -0
- package/src/widgets/CaptivateBanner/config.ts +72 -0
- package/src/widgets/CaptivateBanner/index.tsx +204 -0
- package/src/widgets/CaptivateBanner/previewDesktop.module.css +51 -0
- package/src/widgets/CaptivateBanner/previewMobile.module.css +51 -0
- package/src/widgets/CaptivateBanner/style.module.css +77 -0
- package/src/widgets/CaptivateBanner/utils.ts +104 -0
- package/src/widgets/CentrallyAlignedPopup/config.ts +42 -0
- package/src/widgets/CentrallyAlignedPopup/index.tsx +109 -0
- package/src/widgets/CentrallyAlignedPopup/modal.tsx +269 -0
- package/src/widgets/CentrallyAlignedPopup/preview.module.css +153 -0
- package/src/widgets/CentrallyAlignedPopup/previewMobile.module.css +153 -0
- package/src/widgets/CentrallyAlignedPopup/style.module.css +283 -0
- package/src/widgets/DirectReward/components/couponDetails.tsx +265 -0
- package/src/widgets/DirectReward/components/userDetails.tsx +117 -0
- package/src/widgets/DirectReward/config.ts +186 -0
- package/src/widgets/DirectReward/directReward.tsx +350 -0
- package/src/widgets/DirectReward/index.tsx +579 -0
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewDesktop.module.css +276 -0
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewMobile.module.css +303 -0
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewDesktop.module.css +511 -0
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewMobile.module.css +462 -0
- package/src/widgets/DirectReward/style.module.css +836 -0
- package/src/widgets/ExitIntentHook.tsx +28 -0
- package/src/widgets/STW/api.ts +70 -0
- package/src/widgets/STW/components/svgFactory.tsx +44 -0
- package/src/widgets/STW/config.ts +193 -0
- package/src/widgets/STW/context.ts +7 -0
- package/src/widgets/STW/couponDetails.tsx +121 -0
- package/src/widgets/STW/index.tsx +733 -0
- package/src/widgets/STW/previewStyles/thankyouPreviewDesktop.module.css +215 -0
- package/src/widgets/STW/previewStyles/thankyouPreviewMobile.module.css +205 -0
- package/src/widgets/STW/previewStyles/userInputsPreviewDesktop.module.css +732 -0
- package/src/widgets/STW/previewStyles/userInputsPreviewMobile.module.css +661 -0
- package/src/widgets/STW/previewStyles/wheelPreviewDesktop.module.css +498 -0
- package/src/widgets/STW/previewStyles/wheelPreviewMobile.module.css +497 -0
- package/src/widgets/STW/stw1.tsx +119 -0
- package/src/widgets/STW/stw2Components/wheelDesign.tsx +183 -0
- package/src/widgets/STW/stw2Pages/couponDetails.tsx +72 -0
- package/src/widgets/STW/stw2Pages/stw2.tsx +212 -0
- package/src/widgets/STW/stw2Pages/style.module.css +1226 -0
- package/src/widgets/STW/stw2Pages/userDetails.tsx +86 -0
- package/src/widgets/STW/stw2Pages/wheel.tsx +117 -0
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewDesktop.module.css +835 -0
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewMobile.module.css +787 -0
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewDesktop.module.css +867 -0
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewMobile.module.css +798 -0
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewDesktop.module.css +572 -0
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewMobile.module.css +559 -0
- package/src/widgets/STW/style.module.css +901 -0
- package/src/widgets/STW/userDetails.tsx +150 -0
- package/src/widgets/STW/utility.ts +664 -0
- package/src/widgets/STW/wheel.tsx +304 -0
- package/src/widgets/ScratchCard/ScratchOff/scratchOff.tsx +157 -0
- package/src/widgets/ScratchCard/config.ts +152 -0
- package/src/widgets/ScratchCard/globalStyle.module.css +931 -0
- package/src/widgets/ScratchCard/index.tsx +546 -0
- package/src/widgets/ScratchCard/modal.tsx +225 -0
- package/src/widgets/ScratchCard/preview.module.css +250 -0
- package/src/widgets/ScratchCard/previewMobile.module.css +247 -0
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewDesktop.module.css +537 -0
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewMobile.module.css +463 -0
- package/src/widgets/ScratchCard/style.module.css +220 -0
- package/src/widgets/ShopifyForm/config.ts +168 -0
- package/src/widgets/ShopifyForm/index.tsx +214 -0
- package/src/widgets/ShopifyForm/previewDesktop.module.css +117 -0
- package/src/widgets/ShopifyForm/previewMobile.module.css +131 -0
- package/src/widgets/ShopifyForm/shopifyForm.tsx +445 -0
- package/src/widgets/ShopifyForm/style.module.css +161 -0
- package/src/widgets/SingleButtonRedirection/config.ts +47 -0
- package/src/widgets/SingleButtonRedirection/index.tsx +121 -0
- package/src/widgets/WebStories/config.ts +105 -0
- package/src/widgets/WebStories/index.css +3 -0
- package/src/widgets/WebStories/index.tsx +282 -0
- package/src/widgets/WebStories/style.module.css +26 -0
- package/src/widgets/index.tsx +3 -0
- package/src/widgets/utility.ts +31 -0
- package/tsconfig.json +12 -0
- package/webpack.config.js +239 -0
package/.eslintrc
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:react/recommended"
|
|
9
|
+
],
|
|
10
|
+
"overrides": [
|
|
11
|
+
],
|
|
12
|
+
"parserOptions": {
|
|
13
|
+
"ecmaVersion": "latest",
|
|
14
|
+
"sourceType": "module"
|
|
15
|
+
},
|
|
16
|
+
"plugins": [
|
|
17
|
+
"react"
|
|
18
|
+
],
|
|
19
|
+
"rules": {
|
|
20
|
+
"react/prop-types": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
},
|
|
6
|
+
extends: [
|
|
7
|
+
'eslint:recommended',
|
|
8
|
+
'plugin:react/recommended',
|
|
9
|
+
'plugin:@typescript-eslint/recommended',
|
|
10
|
+
],
|
|
11
|
+
overrides: [],
|
|
12
|
+
parser: '@typescript-eslint/parser',
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: 'latest',
|
|
15
|
+
sourceType: 'module',
|
|
16
|
+
},
|
|
17
|
+
plugins: ['react', '@typescript-eslint'],
|
|
18
|
+
rules: {},
|
|
19
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
name: CI/CD
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
types: [labeled]
|
|
5
|
+
env:
|
|
6
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
7
|
+
GCP_SERVICE_ACCOUNT_JSON: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test-widgets:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
if: ${{ github.event.label.name == 'test:stage' }}
|
|
13
|
+
steps:
|
|
14
|
+
- name: Set Run ID Variable
|
|
15
|
+
run: echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
|
16
|
+
- name: Display Run ID
|
|
17
|
+
run: echo $GITHUB_RUN_ID
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v3
|
|
20
|
+
- name: Set up Node.js
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: '16'
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm install --force
|
|
26
|
+
- name: Test widgets
|
|
27
|
+
run: npm run cypress-staging
|
|
28
|
+
|
|
29
|
+
build-widgets:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
if: ${{ github.event.label.name == 'build:stage' }}
|
|
32
|
+
steps:
|
|
33
|
+
- name: Set Run ID Variable
|
|
34
|
+
run: echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
|
35
|
+
- name: Display Run ID
|
|
36
|
+
run: echo $GITHUB_RUN_ID
|
|
37
|
+
- name: Checkout code
|
|
38
|
+
uses: actions/checkout@v3
|
|
39
|
+
- name: Set up Node.js
|
|
40
|
+
uses: actions/setup-node@v3
|
|
41
|
+
with:
|
|
42
|
+
node-version: '16'
|
|
43
|
+
- name: Install dependencies
|
|
44
|
+
run: npm install --force
|
|
45
|
+
- name: Build widgets
|
|
46
|
+
run: npm run build-widgets
|
|
47
|
+
- name: Upload artifacts
|
|
48
|
+
uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
build-mfe:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
if: ${{ github.event.label.name == 'build:stage' }}
|
|
56
|
+
steps:
|
|
57
|
+
- name: Set Run ID Variable
|
|
58
|
+
run: echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
|
59
|
+
- name: Display Run ID
|
|
60
|
+
run: echo $GITHUB_RUN_ID
|
|
61
|
+
- name: Checkout code
|
|
62
|
+
uses: actions/checkout@v3
|
|
63
|
+
- name: Set up Node.js
|
|
64
|
+
uses: actions/setup-node@v3
|
|
65
|
+
with:
|
|
66
|
+
node-version: '16'
|
|
67
|
+
- name: Install dependencies
|
|
68
|
+
run: npm install --force
|
|
69
|
+
- name: Build mfe
|
|
70
|
+
run: npm run build-mfe
|
|
71
|
+
- name: Upload artifacts
|
|
72
|
+
uses: actions/upload-artifact@v4
|
|
73
|
+
with:
|
|
74
|
+
name: dist-mfe
|
|
75
|
+
path: dist-mfe/
|
|
76
|
+
|
|
77
|
+
build-widgets-prod:
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
if: ${{ github.event.label.name == 'build:prod'}}
|
|
80
|
+
steps:
|
|
81
|
+
- name: Set Run ID Variable
|
|
82
|
+
run: echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
|
83
|
+
- name: Display Run ID
|
|
84
|
+
run: echo $GITHUB_RUN_ID
|
|
85
|
+
- name: Checkout code
|
|
86
|
+
uses: actions/checkout@v3
|
|
87
|
+
- name: Set up Node.js
|
|
88
|
+
uses: actions/setup-node@v3
|
|
89
|
+
with:
|
|
90
|
+
node-version: '16'
|
|
91
|
+
- name: Install dependencies
|
|
92
|
+
run: npm install --force
|
|
93
|
+
- name: Build widgets prod
|
|
94
|
+
run: npm run build-widgets-prod
|
|
95
|
+
- name: Upload artifacts
|
|
96
|
+
uses: actions/upload-artifact@v4
|
|
97
|
+
with:
|
|
98
|
+
name: dist
|
|
99
|
+
path: dist/
|
|
100
|
+
|
|
101
|
+
build-mfe-prod:
|
|
102
|
+
runs-on: ubuntu-latest
|
|
103
|
+
if: ${{ github.event.label.name == 'build:prod'}}
|
|
104
|
+
steps:
|
|
105
|
+
- name: Set Run ID Variable
|
|
106
|
+
run: echo "GITHUB_RUN_ID=${{ github.run_id }}" >> $GITHUB_ENV
|
|
107
|
+
- name: Display Run ID
|
|
108
|
+
run: echo $GITHUB_RUN_ID
|
|
109
|
+
- name: Checkout code
|
|
110
|
+
uses: actions/checkout@v3
|
|
111
|
+
- name: Set up Node.js
|
|
112
|
+
uses: actions/setup-node@v3
|
|
113
|
+
with:
|
|
114
|
+
node-version: '16'
|
|
115
|
+
- name: Install dependencies
|
|
116
|
+
run: npm install --force
|
|
117
|
+
- name: Build mfe prod
|
|
118
|
+
run: npm run build-mfe-prod
|
|
119
|
+
- name: Upload artifacts
|
|
120
|
+
uses: actions/upload-artifact@v4
|
|
121
|
+
with:
|
|
122
|
+
name: dist-mfe
|
|
123
|
+
path: dist-mfe/
|
|
124
|
+
|
|
125
|
+
upload-widgets:
|
|
126
|
+
needs: build-widgets
|
|
127
|
+
runs-on: ubuntu-latest
|
|
128
|
+
if: ${{ github.event.label.name == 'build:stage' }}
|
|
129
|
+
steps:
|
|
130
|
+
- name: Checkout repository
|
|
131
|
+
uses: actions/checkout@v3
|
|
132
|
+
- name: Authenticate with Google Cloud
|
|
133
|
+
uses: google-github-actions/auth@v2
|
|
134
|
+
with:
|
|
135
|
+
project_id: staging-bikayi
|
|
136
|
+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
|
|
137
|
+
- name: Set up Google Cloud SDK
|
|
138
|
+
uses: google-github-actions/setup-gcloud@v2
|
|
139
|
+
- name: Download artifacts
|
|
140
|
+
uses: actions/download-artifact@v4
|
|
141
|
+
with:
|
|
142
|
+
name: dist
|
|
143
|
+
path: dist/
|
|
144
|
+
- name: Clear existing old chunks folder
|
|
145
|
+
run: |
|
|
146
|
+
gsutil -m rm -r gs://bik-widget-mfe/bap/old-chunks/*
|
|
147
|
+
- name: Copy current chucks folder to old chunks folder
|
|
148
|
+
run: |
|
|
149
|
+
gsutil -m cp gs://bik-widget-mfe/bap/chunks/* gs://bik-widget-mfe/bap/old-chunks
|
|
150
|
+
- name: Clear existing chunks folder
|
|
151
|
+
run: |
|
|
152
|
+
gsutil -m rm -r gs://bik-widget-mfe/bap/chunks/*
|
|
153
|
+
- name: Upload artifacts to Google Cloud Storage
|
|
154
|
+
run: |
|
|
155
|
+
gsutil -m cp dist/chunks/* gs://bik-widget-mfe/bap/chunks
|
|
156
|
+
gsutil -m cp dist/chunks/*.map gs://bik-widget-mfe/bap/source-map
|
|
157
|
+
gsutil cp dist/vendor.js gs://bik-widget-mfe/bap/widget-vendor/vendor.js
|
|
158
|
+
gsutil cp dist/vendor.js.map gs://bik-widget-mfe/bap/source-map/vendor.js.map
|
|
159
|
+
gsutil cp dist/stw.js gs://bik-widget-mfe/bap/widget-stw/stw.js
|
|
160
|
+
gsutil cp dist/captivateBanner.js gs://bik-widget-mfe/bap/widget-captivate-banner/captivateBanner.js
|
|
161
|
+
gsutil cp dist/shopifyForm.js gs://bik-widget-mfe/bap/widget-shopify-form/shopifyForm.js
|
|
162
|
+
gsutil cp dist/stw.js.map gs://bik-widget-mfe/bap/source-map/stw.js.map
|
|
163
|
+
gsutil cp dist/bottomDrawer.js gs://bik-widget-mfe/bap/widget-bottom-drawer/bottomDrawer.js
|
|
164
|
+
gsutil cp dist/bottomDrawer.js.map gs://bik-widget-mfe/bap/source-map/bottomDrawer.js.map
|
|
165
|
+
gsutil cp dist/scratchCard.js gs://bik-widget-mfe/bap/widget-scratch-card/scratchCard.js
|
|
166
|
+
gsutil cp dist/directReward.js gs://bik-widget-mfe/bap/widget-direct-reward/directReward.js
|
|
167
|
+
gsutil cp dist/directReward.js.map gs://bik-widget-mfe/bap/source-map/directReward.js.map
|
|
168
|
+
gsutil cp dist/singleButtonRedirection.js gs://bik-widget-mfe/bap/widget-single-button-redirection/singleButtonRedirection.js
|
|
169
|
+
gsutil cp dist/singleButtonRedirection.js.map gs://bik-widget-mfe/bap/source-map/singleButtonRedirection.js.map
|
|
170
|
+
gsutil cp dist/centrallyAligned.js gs://bik-widget-mfe/bap/widget-centrally-aligned/centrallyAligned.js
|
|
171
|
+
gsutil cp dist/centrallyAligned.js.map gs://bik-widget-mfe/bap/source-map/centrallyAligned.js.map
|
|
172
|
+
- name: Clean up
|
|
173
|
+
run: |
|
|
174
|
+
echo "Uploaded artifacts to buckets successfully"
|
|
175
|
+
rm -rf dist/
|
|
176
|
+
rm -rf /tmp/$GITHUB_RUN_ID.json
|
|
177
|
+
|
|
178
|
+
upload-mfe:
|
|
179
|
+
needs: build-mfe
|
|
180
|
+
runs-on: ubuntu-latest
|
|
181
|
+
if: ${{ github.event.label.name == 'build:stage' }}
|
|
182
|
+
steps:
|
|
183
|
+
- name: Checkout repository
|
|
184
|
+
uses: actions/checkout@v3
|
|
185
|
+
- name: Authenticate with Google Cloud
|
|
186
|
+
uses: google-github-actions/auth@v2
|
|
187
|
+
with:
|
|
188
|
+
project_id: staging-bikayi
|
|
189
|
+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
|
|
190
|
+
- name: Set up Google Cloud SDK
|
|
191
|
+
uses: google-github-actions/setup-gcloud@v2
|
|
192
|
+
- name: Download artifacts
|
|
193
|
+
uses: actions/download-artifact@v4
|
|
194
|
+
with:
|
|
195
|
+
name: dist-mfe
|
|
196
|
+
path: dist-mfe/
|
|
197
|
+
- name: Clear existing old mfe chunks folder
|
|
198
|
+
run: |
|
|
199
|
+
gsutil -m rm -r gs://bik-widget-mfe/bap/mfe/old-chunks/*
|
|
200
|
+
- name: Copy current mfe chucks folder to old mfe chunks folder
|
|
201
|
+
run: |
|
|
202
|
+
gsutil -m cp gs://bik-widget-mfe/bap/mfe/chunks/* gs://bik-widget-mfe/bap/mfe/old-chunks
|
|
203
|
+
- name: Clear existing mfe chunks
|
|
204
|
+
run: |
|
|
205
|
+
gsutil -m rm -r gs://bik-widget-mfe/bap/mfe/chunks/*
|
|
206
|
+
- name: Upload artifacts to Google Cloud Storage
|
|
207
|
+
run: |
|
|
208
|
+
gsutil -m cp -r dist-mfe/* gs://bik-widget-mfe/bap/mfe
|
|
209
|
+
- name: Clean up
|
|
210
|
+
run: |
|
|
211
|
+
echo "Uploaded artifacts to buckets successfully"
|
|
212
|
+
rm -rf dist/
|
|
213
|
+
rm -rf /tmp/$GITHUB_RUN_ID.json
|
|
214
|
+
|
|
215
|
+
upload-widgets-prod:
|
|
216
|
+
needs: build-widgets-prod
|
|
217
|
+
runs-on: ubuntu-latest
|
|
218
|
+
if: ${{ github.event.label.name == 'build:prod'}}
|
|
219
|
+
steps:
|
|
220
|
+
- name: Checkout repository
|
|
221
|
+
uses: actions/checkout@v3
|
|
222
|
+
- name: Authenticate with Google Cloud
|
|
223
|
+
uses: google-github-actions/auth@v2
|
|
224
|
+
with:
|
|
225
|
+
project_id: bikai-d5ee5
|
|
226
|
+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
|
|
227
|
+
- name: Set up Google Cloud SDK
|
|
228
|
+
uses: google-github-actions/setup-gcloud@v2
|
|
229
|
+
- name: Download artifacts
|
|
230
|
+
uses: actions/download-artifact@v4
|
|
231
|
+
with:
|
|
232
|
+
name: dist
|
|
233
|
+
path: dist/
|
|
234
|
+
- name: Clear existing old chunks folder (PROD)
|
|
235
|
+
run: gsutil -m rm -r gs://bik-assets/bap/old-chunks/*
|
|
236
|
+
- name: Copy current chucks folder to old chunks folder (PROD)
|
|
237
|
+
run: |
|
|
238
|
+
gsutil -m cp gs://bik-assets/bap/chunks/* gs://bik-assets/bap/old-chunks
|
|
239
|
+
- name: Clear existing chunks folder (PROD)
|
|
240
|
+
run: |
|
|
241
|
+
gsutil -m rm -r gs://bik-assets/bap/chunks/*
|
|
242
|
+
- name: Upload artifacts to Google Cloud Storage (PROD)
|
|
243
|
+
run: |
|
|
244
|
+
gsutil -m cp -r dist/* gs://bik-assets/bap/mfe
|
|
245
|
+
gsutil -m cp dist/chunks/* gs://bik-assets/bap/chunks
|
|
246
|
+
gsutil -m cp dist/chunks/*.map gs://bik-assets/bap/source-map
|
|
247
|
+
gsutil cp dist/vendor.js gs://bik-assets/bap/widget-vendor/vendor.js
|
|
248
|
+
gsutil cp dist/vendor.js.map gs://bik-assets/bap/source-map/vendor.js.map
|
|
249
|
+
gsutil cp dist/stw.js gs://bik-assets/bap/widget-stw/stw.js
|
|
250
|
+
gsutil cp dist/captivateBanner.js gs://bik-assets/bap/widget-captivate-banner/captivateBanner.js
|
|
251
|
+
gsutil cp dist/shopifyForm.js gs://bik-assets/bap/widget-shopify-form/shopifyForm.js
|
|
252
|
+
gsutil cp dist/stw.js.map gs://bik-assets/bap/source-map/stw.js.map
|
|
253
|
+
gsutil cp dist/bottomDrawer.js gs://bik-assets/bap/widget-bottom-drawer/bottomDrawer.js
|
|
254
|
+
gsutil cp dist/bottomDrawer.js.map gs://bik-assets/bap/source-map/bottomDrawer.js.map
|
|
255
|
+
gsutil cp dist/scratchCard.js gs://bik-assets/bap/widget-scratch-card/scratchCard.js
|
|
256
|
+
gsutil cp dist/directReward.js gs://bik-assets/bap/widget-direct-reward/directReward.js
|
|
257
|
+
gsutil cp dist/directReward.js.map gs://bik-assets/bap/source-map/directReward.js.map
|
|
258
|
+
gsutil cp dist/singleButtonRedirection.js gs://bik-assets/bap/widget-single-button-redirection/singleButtonRedirection.js
|
|
259
|
+
gsutil cp dist/singleButtonRedirection.js.map gs://bik-assets/bap/source-map/singleButtonRedirection.js.map
|
|
260
|
+
gsutil cp dist/centrallyAligned.js gs://bik-assets/bap/widget-centrally-aligned/centrallyAligned.js
|
|
261
|
+
gsutil cp dist/centrallyAligned.js.map gs://bik-assets/bap/source-map/centrallyAligned.js.map
|
|
262
|
+
|
|
263
|
+
upload-mfe-prod:
|
|
264
|
+
needs: build-mfe-prod
|
|
265
|
+
runs-on: ubuntu-latest
|
|
266
|
+
if: ${{ github.event.label.name == 'build:prod'}}
|
|
267
|
+
steps:
|
|
268
|
+
- name: Checkout repository
|
|
269
|
+
uses: actions/checkout@v3
|
|
270
|
+
- name: Authenticate with Google Cloud
|
|
271
|
+
uses: google-github-actions/auth@v2
|
|
272
|
+
with:
|
|
273
|
+
project_id: bikai-d5ee5
|
|
274
|
+
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }}
|
|
275
|
+
- name: Set up Google Cloud SDK
|
|
276
|
+
uses: google-github-actions/setup-gcloud@v2
|
|
277
|
+
- name: Download artifacts
|
|
278
|
+
uses: actions/download-artifact@v4
|
|
279
|
+
with:
|
|
280
|
+
name: dist-mfe
|
|
281
|
+
path: dist-mfe/
|
|
282
|
+
- name: Clear existing old mfe chunks folder (PROD)
|
|
283
|
+
run: |
|
|
284
|
+
gsutil -m rm -r gs://bik-assets/bap/mfe/old-chunks/*
|
|
285
|
+
- name: Copy current mfe chucks folder to old mfe chunks folder (PROD)
|
|
286
|
+
run: |
|
|
287
|
+
gsutil -m cp gs://bik-assets/bap/mfe/chunks/* gs://bik-assets/bap/mfe/old-chunks
|
|
288
|
+
- name: Clear existing mfe chunks (PROD)
|
|
289
|
+
run: |
|
|
290
|
+
gsutil -m rm -r gs://bik-assets/bap/mfe/chunks/*
|
|
291
|
+
- name: Upload artifacts to Google Cloud Storage (PROD)
|
|
292
|
+
run: |
|
|
293
|
+
gsutil -m cp -r dist-mfe/* gs://bik-assets/bap/mfe
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
### Deploying mfe assets to bucket automatically
|
|
2
|
+
|
|
3
|
+
Follow below steps
|
|
4
|
+
|
|
5
|
+
- run `npm run build-mfe` locally
|
|
6
|
+
- stage all changes and push/merge with `bap/qa`
|
|
7
|
+
- Pipeline will auto run once it detects changes in `dist/moduleEntry.js`
|
|
8
|
+
|
|
9
|
+
## Log Server
|
|
10
|
+
|
|
11
|
+
A WebSocket server for collecting and displaying logs from your application in real-time, useful for debugging and monitoring during development on mobile devices.
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
#### Start the Server
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run log-server
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The server will start and listen for incoming WebSocket connections. By default, it listens on port 4040, but you can specify a custom port:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run log-server 4001
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### Log Format
|
|
28
|
+
|
|
29
|
+
The server expects log messages in JSON format with the following structure:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"level": "info",
|
|
34
|
+
"message": "Your log message",
|
|
35
|
+
"timestamp": "2025-07-08T10:30:00.000Z",
|
|
36
|
+
"data": "optional additional data",
|
|
37
|
+
"source": "client"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Viewing Logs
|
|
42
|
+
|
|
43
|
+
Once connected, the server will display formatted logs in the terminal with:
|
|
44
|
+
|
|
45
|
+
- Color-coded log levels (error: red, warn: yellow, info: blue, debug: cyan)
|
|
46
|
+
- Timestamps with milliseconds
|
|
47
|
+
- Source information
|
|
48
|
+
- Additional data if provided
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## useWebSocketLogger Hook
|
|
53
|
+
|
|
54
|
+
A custom React hook for sending logs from the frontend to the WebSocket log server in real-time.
|
|
55
|
+
|
|
56
|
+
### Features
|
|
57
|
+
|
|
58
|
+
- Establishes a WebSocket connection to the log server
|
|
59
|
+
- Queues log messages when connection is not available
|
|
60
|
+
- Automatic reconnection with exponential backoff
|
|
61
|
+
- Supports multiple log levels (info, warn, error, debug)
|
|
62
|
+
- Conditional logging based on server availability
|
|
63
|
+
|
|
64
|
+
### Usage
|
|
65
|
+
|
|
66
|
+
#### Import the Hook
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import { useWebSocketLogger } from '../hooks/useWebSocketLogger';
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Use in a Component
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const logger = useWebSocketLogger(true); // Pass true when log server is started
|
|
76
|
+
|
|
77
|
+
// Log messages with different levels
|
|
78
|
+
logger.log('User clicked button');
|
|
79
|
+
logger.warn('Performance warning', { loadTime: 2000 });
|
|
80
|
+
logger.error('API request failed', { error: 'Network timeout' });
|
|
81
|
+
logger.debug('Debug information', { userId: 123 });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### API
|
|
85
|
+
|
|
86
|
+
- `useWebSocketLogger(isWebSocketServerStarted: boolean)`
|
|
87
|
+
- `isWebSocketServerStarted`: Boolean flag to enable/disable WebSocket connection
|
|
88
|
+
- Returns an object with logging methods
|
|
89
|
+
|
|
90
|
+
#### Methods
|
|
91
|
+
|
|
92
|
+
- `log(message: string, data?: unknown)`: Log info level message
|
|
93
|
+
- `warn(message: string, data?: unknown)`: Log warning level message
|
|
94
|
+
- `error(message: string, data?: unknown)`: Log error level message
|
|
95
|
+
- `debug(message: string, data?: unknown)`: Log debug level message
|
|
96
|
+
|
|
97
|
+
#### Example
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { useWebSocketLogger } from '../hooks/useWebSocketLogger';
|
|
101
|
+
|
|
102
|
+
const MyComponent = () => {
|
|
103
|
+
const logger = useWebSocketLogger(process.env.NODE_ENV === 'development');
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
logger.log('Component mounted');
|
|
107
|
+
|
|
108
|
+
// Log with additional data
|
|
109
|
+
logger.debug('User data loaded', {
|
|
110
|
+
userId: user.id,
|
|
111
|
+
timestamp: Date.now(),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return () => {
|
|
115
|
+
logger.log('Component unmounted');
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
const handleError = error => {
|
|
120
|
+
logger.error('Button click failed', {
|
|
121
|
+
error: error.message,
|
|
122
|
+
stack: error.stack,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return <button onClick={handleClick}>Click me</button>;
|
|
127
|
+
};
|
|
128
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function GetWidgetSrc(widgetId: string, templateId: string) {
|
|
2
|
+
return `${getBaseUrl()}/publicApiFunctions-getWidgetSourceV3/${templateId}/${Cypress.env('storeId')}/${widgetId}`;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function GetVendorSrc() {
|
|
6
|
+
return `${getBaseUrl()}/publicApiFunctions-getCommonScripts/vendor`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function GetEventRequest() {
|
|
10
|
+
return `${getBaseUrl('dm')}/publicApiFunctions-sendWidgetEvent`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function GetCouponRequest() {
|
|
14
|
+
return `${getBaseUrl('dm')}/publicApiFunctions-fetchCouponCode`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getBaseUrl(balancer?: string) {
|
|
18
|
+
return Cypress.env('isProd')
|
|
19
|
+
? `https://bikapi.bikayi.app/bap/${balancer ?? 'static-scr'}`
|
|
20
|
+
: `https://api.staging.bik.ai/${balancer ?? 'dm'}`;
|
|
21
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getBaseUrl } from './endpoints';
|
|
2
|
+
|
|
3
|
+
class ApiRequest {
|
|
4
|
+
baseURL;
|
|
5
|
+
defaultHeaders;
|
|
6
|
+
constructor() {
|
|
7
|
+
this.baseURL = getBaseUrl();
|
|
8
|
+
this.defaultHeaders = {
|
|
9
|
+
authorization: Cypress.env('accessToken'),
|
|
10
|
+
'bik-referer': 'bik',
|
|
11
|
+
'Content-Type': 'application/json',
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get(url, queryParams = {}, headers = {}) {
|
|
16
|
+
return this.request('GET', url, queryParams, headers);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
post(url, body = {}, headers = {}) {
|
|
20
|
+
return this.request('POST', url, {}, headers, body);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
request(method, url, queryParams = {}, headers = {}, body = {}) {
|
|
24
|
+
const requestOptions = {
|
|
25
|
+
method,
|
|
26
|
+
url: `${this.baseURL}${url}`,
|
|
27
|
+
headers: {
|
|
28
|
+
...this.defaultHeaders,
|
|
29
|
+
...headers,
|
|
30
|
+
},
|
|
31
|
+
qs: queryParams,
|
|
32
|
+
body: {
|
|
33
|
+
...body,
|
|
34
|
+
storeId: Cypress.env('storeId'),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return cy.request(requestOptions);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default ApiRequest;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetEventRequest,
|
|
3
|
+
GetVendorSrc,
|
|
4
|
+
GetWidgetSrc,
|
|
5
|
+
} from '../apiHelper/endpoints';
|
|
6
|
+
import ApiRequest from '../apiHelper/executor';
|
|
7
|
+
import { BOTTOM_DRAWER_PAYLOAD } from '../fixtures/payloads';
|
|
8
|
+
|
|
9
|
+
describe('Bottom drawer e2e', () => {
|
|
10
|
+
it('should make an API call, open a URL, and perform frontend testing', () => {
|
|
11
|
+
new ApiRequest()
|
|
12
|
+
.post('/utilApiFunctions-deleteAllWidgets', {
|
|
13
|
+
password: 'sn@1234@A',
|
|
14
|
+
})
|
|
15
|
+
.then(() => {
|
|
16
|
+
new ApiRequest()
|
|
17
|
+
.post('/widgetInfraApiFunctions-publishWidget', BOTTOM_DRAWER_PAYLOAD)
|
|
18
|
+
.then(response => {
|
|
19
|
+
expect(response.status).to.eq(200);
|
|
20
|
+
expect(response.body).to.have.property('widgetId');
|
|
21
|
+
let apiCalled = false;
|
|
22
|
+
const widgetId = response.body.widgetId;
|
|
23
|
+
const templateId = 'P29OopljI3TkkYdfxJE0';
|
|
24
|
+
cy.intercept('POST', GetEventRequest(), req => {
|
|
25
|
+
apiCalled = true;
|
|
26
|
+
req.continue();
|
|
27
|
+
}).as('apiCall');
|
|
28
|
+
cy.visit(Cypress.env('storeUrl'));
|
|
29
|
+
cy.get(`script[src^="${GetVendorSrc()}"]`, {
|
|
30
|
+
timeout: 10000,
|
|
31
|
+
}).should('exist');
|
|
32
|
+
cy.get(
|
|
33
|
+
`script[src^="${GetWidgetSrc(widgetId, templateId)}"]`,
|
|
34
|
+
).should('exist');
|
|
35
|
+
cy.get(`div[id="bik-widget-wrapper-${widgetId}"]`).should('exist');
|
|
36
|
+
cy.wrap(null).should(() => {
|
|
37
|
+
expect(apiCalled).to.be.true;
|
|
38
|
+
});
|
|
39
|
+
cy.get(`div[id="bik-widget-root-${widgetId}"]`).should('exist');
|
|
40
|
+
cy.get(`button[id="bik-bd-${widgetId}-cta-fab"]`).should('exist');
|
|
41
|
+
cy.get(`button[id="bik-bd-${widgetId}-cta-fab"]`).click();
|
|
42
|
+
cy.get(`button[id="bik-bd-${widgetId}-cta-whatsapp"]`).should(
|
|
43
|
+
'exist',
|
|
44
|
+
);
|
|
45
|
+
cy.get(`button[id="bik-bd-${widgetId}-cta-whatsapp"]`).click();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetEventRequest,
|
|
3
|
+
GetVendorSrc,
|
|
4
|
+
GetWidgetSrc,
|
|
5
|
+
GetCouponRequest,
|
|
6
|
+
} from '../apiHelper/endpoints';
|
|
7
|
+
import ApiRequest from '../apiHelper/executor';
|
|
8
|
+
import { DIRECT_REWARD_PAYLOAD } from '../fixtures/payloads';
|
|
9
|
+
|
|
10
|
+
describe('Direct Reward e2e', () => {
|
|
11
|
+
it('should make an API call, open a URL, and perform frontend testing', () => {
|
|
12
|
+
new ApiRequest()
|
|
13
|
+
.post('/utilApiFunctions-deleteAllWidgets', {
|
|
14
|
+
password: 'sn@1234@A',
|
|
15
|
+
})
|
|
16
|
+
.then(() => {
|
|
17
|
+
new ApiRequest()
|
|
18
|
+
.post('/widgetInfraApiFunctions-publishWidget', DIRECT_REWARD_PAYLOAD)
|
|
19
|
+
.then(response => {
|
|
20
|
+
expect(response.status).to.eq(200);
|
|
21
|
+
expect(response.body).to.have.property('widgetId');
|
|
22
|
+
let apiCalled = false;
|
|
23
|
+
let fetchedCoupon = false;
|
|
24
|
+
const widgetId = response.body.widgetId;
|
|
25
|
+
const templateId = '7fM9X24TY9Bk9f7fIG9C';
|
|
26
|
+
cy.intercept('POST', GetEventRequest(), req => {
|
|
27
|
+
apiCalled = true;
|
|
28
|
+
req.continue();
|
|
29
|
+
}).as('apiCall');
|
|
30
|
+
cy.intercept('POST', GetCouponRequest(), req => {
|
|
31
|
+
fetchedCoupon = true;
|
|
32
|
+
req.continue();
|
|
33
|
+
}).as('fetchCouponCall');
|
|
34
|
+
cy.visit(Cypress.env('storeUrl'));
|
|
35
|
+
cy.get(`script[src^="${GetVendorSrc()}"]`, {
|
|
36
|
+
timeout: 10000,
|
|
37
|
+
}).should('exist');
|
|
38
|
+
cy.get(
|
|
39
|
+
`script[src^="${GetWidgetSrc(widgetId, templateId)}"]`,
|
|
40
|
+
).should('exist');
|
|
41
|
+
cy.get(`div[id="bik-widget-wrapper-${widgetId}"]`, {
|
|
42
|
+
timeout: 10000,
|
|
43
|
+
}).should('exist');
|
|
44
|
+
cy.wrap(null).should(() => {
|
|
45
|
+
expect(apiCalled).to.be.true;
|
|
46
|
+
});
|
|
47
|
+
cy.get(
|
|
48
|
+
`div[id="bik-dr-${widgetId}-user-details-container"]`,
|
|
49
|
+
).should('exist');
|
|
50
|
+
cy.get(`input[id="bik-${widgetId}-input-whatsapp"]`).should(
|
|
51
|
+
'exist',
|
|
52
|
+
);
|
|
53
|
+
cy.get(`input[id="bik-${widgetId}-input-whatsapp"]`).type(
|
|
54
|
+
'7358264637',
|
|
55
|
+
);
|
|
56
|
+
cy.get(`div[id="bik-dr-${widgetId}-user-details-container"]`)
|
|
57
|
+
.find('button')
|
|
58
|
+
.click();
|
|
59
|
+
cy.wait(2000);
|
|
60
|
+
cy.wrap(null).should(() => {
|
|
61
|
+
expect(fetchedCoupon).to.be.true;
|
|
62
|
+
});
|
|
63
|
+
cy.get(`div[id="bik-${widgetId}-coupon-screen"]`).should('exist');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|