@plaidev/karte-action-sdk 1.1.268-29111070.d0bdfb56 → 1.1.268-29127338.e0debfc5

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 (254) hide show
  1. package/dist/action.d.ts +63 -0
  2. package/dist/actionEvent.d.ts +25 -0
  3. package/dist/collection.d.ts +121 -0
  4. package/dist/components/index.d.ts +32 -0
  5. package/dist/components-flex/avatar/styles.d.ts +3 -0
  6. package/dist/components-flex/avatar/types.d.ts +24 -0
  7. package/dist/components-flex/brand-kit.d.ts +16 -0
  8. package/dist/components-flex/button/styles.d.ts +8 -0
  9. package/dist/components-flex/button/types.d.ts +57 -0
  10. package/dist/components-flex/button-outlined/styles.d.ts +8 -0
  11. package/dist/components-flex/button-outlined/types.d.ts +20 -0
  12. package/dist/components-flex/button-text/styles.d.ts +6 -0
  13. package/dist/components-flex/button-text/types.d.ts +33 -0
  14. package/dist/components-flex/clip-copy/types.d.ts +6 -0
  15. package/dist/components-flex/close-button/types.d.ts +32 -0
  16. package/dist/components-flex/code/types.d.ts +6 -0
  17. package/dist/components-flex/count-down/types.d.ts +17 -0
  18. package/dist/components-flex/icon/styles.d.ts +3 -0
  19. package/dist/components-flex/icon/types.d.ts +18 -0
  20. package/dist/components-flex/image/styles.d.ts +3 -0
  21. package/dist/components-flex/image/types.d.ts +26 -0
  22. package/dist/components-flex/layout/types.d.ts +20 -0
  23. package/dist/components-flex/list/types.d.ts +30 -0
  24. package/dist/components-flex/modal/types.d.ts +5 -0
  25. package/dist/components-flex/multi-column/types.d.ts +31 -0
  26. package/dist/components-flex/props.d.ts +91 -0
  27. package/dist/components-flex/schemas.d.ts +36 -0
  28. package/dist/components-flex/shared/styles.d.ts +3 -0
  29. package/dist/components-flex/shared/types.d.ts +13 -0
  30. package/dist/components-flex/slider/types.d.ts +10 -0
  31. package/dist/components-flex/styles.d.ts +9 -0
  32. package/dist/components-flex/text/constants.d.ts +4 -0
  33. package/dist/components-flex/text/styles.d.ts +7 -0
  34. package/dist/components-flex/text/types.d.ts +37 -0
  35. package/dist/components-flex/text-link/styles.d.ts +6 -0
  36. package/dist/components-flex/text-link/types.d.ts +31 -0
  37. package/dist/components-flex/utils/color.d.ts +7 -0
  38. package/dist/components-flex/utils/obj-to-style.d.ts +2 -0
  39. package/dist/components-flex/utils/parser.d.ts +5 -0
  40. package/dist/components-flex/utils/prop-to-style.d.ts +11 -0
  41. package/dist/components-flex/variants.d.ts +42 -0
  42. package/dist/components-flex/youtube/types.d.ts +16 -0
  43. package/dist/constants.d.ts +27 -0
  44. package/dist/display-logic.d.ts +125 -0
  45. package/dist/enhancedStopPropagation.d.ts +6 -0
  46. package/dist/form.d.ts +100 -0
  47. package/dist/functions.d.ts +71 -0
  48. package/dist/hooks/useClickable.d.ts +7 -0
  49. package/dist/hooks/useInjectCustomizeCss.d.ts +2 -0
  50. package/dist/hooks/useText.d.ts +5 -0
  51. package/dist/hydrate/action.d.ts +63 -0
  52. package/dist/hydrate/actionEvent.d.ts +25 -0
  53. package/dist/hydrate/collection.d.ts +121 -0
  54. package/dist/hydrate/components/index.d.ts +32 -0
  55. package/dist/hydrate/components-flex/avatar/styles.d.ts +3 -0
  56. package/dist/hydrate/components-flex/avatar/types.d.ts +24 -0
  57. package/dist/hydrate/components-flex/brand-kit.d.ts +16 -0
  58. package/dist/hydrate/components-flex/button/styles.d.ts +8 -0
  59. package/dist/hydrate/components-flex/button/types.d.ts +57 -0
  60. package/dist/hydrate/components-flex/button-outlined/styles.d.ts +8 -0
  61. package/dist/hydrate/components-flex/button-outlined/types.d.ts +20 -0
  62. package/dist/hydrate/components-flex/button-text/styles.d.ts +6 -0
  63. package/dist/hydrate/components-flex/button-text/types.d.ts +33 -0
  64. package/dist/hydrate/components-flex/clip-copy/types.d.ts +6 -0
  65. package/dist/hydrate/components-flex/close-button/types.d.ts +32 -0
  66. package/dist/hydrate/components-flex/code/types.d.ts +6 -0
  67. package/dist/hydrate/components-flex/count-down/types.d.ts +17 -0
  68. package/dist/hydrate/components-flex/icon/styles.d.ts +3 -0
  69. package/dist/hydrate/components-flex/icon/types.d.ts +18 -0
  70. package/dist/hydrate/components-flex/image/styles.d.ts +3 -0
  71. package/dist/hydrate/components-flex/image/types.d.ts +26 -0
  72. package/dist/hydrate/components-flex/layout/types.d.ts +20 -0
  73. package/dist/hydrate/components-flex/list/types.d.ts +30 -0
  74. package/dist/hydrate/components-flex/modal/types.d.ts +5 -0
  75. package/dist/hydrate/components-flex/multi-column/types.d.ts +31 -0
  76. package/dist/hydrate/components-flex/props.d.ts +91 -0
  77. package/dist/hydrate/components-flex/schemas.d.ts +36 -0
  78. package/dist/hydrate/components-flex/shared/styles.d.ts +3 -0
  79. package/dist/hydrate/components-flex/shared/types.d.ts +13 -0
  80. package/dist/hydrate/components-flex/slider/types.d.ts +10 -0
  81. package/dist/hydrate/components-flex/styles.d.ts +9 -0
  82. package/dist/hydrate/components-flex/text/constants.d.ts +4 -0
  83. package/dist/hydrate/components-flex/text/styles.d.ts +7 -0
  84. package/dist/hydrate/components-flex/text/types.d.ts +37 -0
  85. package/dist/hydrate/components-flex/text-link/styles.d.ts +6 -0
  86. package/dist/hydrate/components-flex/text-link/types.d.ts +31 -0
  87. package/dist/hydrate/components-flex/utils/color.d.ts +7 -0
  88. package/dist/hydrate/components-flex/utils/obj-to-style.d.ts +2 -0
  89. package/dist/hydrate/components-flex/utils/parser.d.ts +5 -0
  90. package/dist/hydrate/components-flex/utils/prop-to-style.d.ts +11 -0
  91. package/dist/hydrate/components-flex/variants.d.ts +42 -0
  92. package/dist/hydrate/components-flex/youtube/types.d.ts +16 -0
  93. package/dist/hydrate/constants.d.ts +27 -0
  94. package/dist/hydrate/display-logic.d.ts +125 -0
  95. package/dist/hydrate/enhancedStopPropagation.d.ts +6 -0
  96. package/dist/hydrate/form.d.ts +100 -0
  97. package/dist/hydrate/functions.d.ts +71 -0
  98. package/dist/hydrate/hooks/useClickable.d.ts +7 -0
  99. package/dist/hydrate/hooks/useInjectCustomizeCss.d.ts +2 -0
  100. package/dist/hydrate/hooks/useText.d.ts +5 -0
  101. package/dist/hydrate/index.d.ts +111 -0
  102. package/dist/hydrate/index.es.js +12721 -12529
  103. package/dist/hydrate/index.svelte5.d.ts +79 -0
  104. package/dist/hydrate/logger.d.ts +48 -0
  105. package/dist/hydrate/modal.d.ts +214 -0
  106. package/dist/hydrate/modal.svelte5.d.ts +214 -0
  107. package/dist/hydrate/prop.d.ts +431 -0
  108. package/dist/hydrate/script.d.ts +33 -0
  109. package/dist/hydrate/stores.d.ts +376 -0
  110. package/dist/hydrate/types.d.ts +183 -0
  111. package/dist/hydrate/utils.d.ts +171 -0
  112. package/dist/hydrate/widget.d.ts +148 -0
  113. package/dist/icons.d.ts +27 -28
  114. package/dist/icons.js +225 -159
  115. package/dist/index.es.d.ts +111 -2988
  116. package/dist/index.es.js +11913 -12372
  117. package/dist/logger.d.ts +48 -0
  118. package/dist/modal.d.ts +214 -0
  119. package/dist/modal.svelte5.d.ts +214 -0
  120. package/dist/prop.d.ts +431 -0
  121. package/dist/script.d.ts +33 -0
  122. package/dist/stores.d.ts +376 -0
  123. package/dist/svelte5/action.d.ts +63 -0
  124. package/dist/svelte5/actionEvent.d.ts +25 -0
  125. package/dist/svelte5/collection.d.ts +121 -0
  126. package/dist/svelte5/components/index.d.ts +32 -0
  127. package/dist/svelte5/components-flex/avatar/styles.d.ts +3 -0
  128. package/dist/svelte5/components-flex/avatar/types.d.ts +24 -0
  129. package/dist/svelte5/components-flex/brand-kit.d.ts +16 -0
  130. package/dist/svelte5/components-flex/button/styles.d.ts +8 -0
  131. package/dist/svelte5/components-flex/button/types.d.ts +57 -0
  132. package/dist/svelte5/components-flex/button-outlined/styles.d.ts +8 -0
  133. package/dist/svelte5/components-flex/button-outlined/types.d.ts +20 -0
  134. package/dist/svelte5/components-flex/button-text/styles.d.ts +6 -0
  135. package/dist/svelte5/components-flex/button-text/types.d.ts +33 -0
  136. package/dist/svelte5/components-flex/clip-copy/types.d.ts +6 -0
  137. package/dist/svelte5/components-flex/close-button/types.d.ts +32 -0
  138. package/dist/svelte5/components-flex/code/types.d.ts +6 -0
  139. package/dist/svelte5/components-flex/count-down/types.d.ts +17 -0
  140. package/dist/svelte5/components-flex/icon/styles.d.ts +3 -0
  141. package/dist/svelte5/components-flex/icon/types.d.ts +18 -0
  142. package/dist/svelte5/components-flex/image/styles.d.ts +3 -0
  143. package/dist/svelte5/components-flex/image/types.d.ts +26 -0
  144. package/dist/svelte5/components-flex/layout/types.d.ts +20 -0
  145. package/dist/svelte5/components-flex/list/types.d.ts +30 -0
  146. package/dist/svelte5/components-flex/modal/types.d.ts +5 -0
  147. package/dist/svelte5/components-flex/multi-column/types.d.ts +31 -0
  148. package/dist/svelte5/components-flex/props.d.ts +91 -0
  149. package/dist/svelte5/components-flex/schemas.d.ts +36 -0
  150. package/dist/svelte5/components-flex/shared/styles.d.ts +3 -0
  151. package/dist/svelte5/components-flex/shared/types.d.ts +13 -0
  152. package/dist/svelte5/components-flex/slider/types.d.ts +10 -0
  153. package/dist/svelte5/components-flex/styles.d.ts +9 -0
  154. package/dist/svelte5/components-flex/text/constants.d.ts +4 -0
  155. package/dist/svelte5/components-flex/text/styles.d.ts +7 -0
  156. package/dist/svelte5/components-flex/text/types.d.ts +37 -0
  157. package/dist/svelte5/components-flex/text-link/styles.d.ts +6 -0
  158. package/dist/svelte5/components-flex/text-link/types.d.ts +31 -0
  159. package/dist/svelte5/components-flex/utils/color.d.ts +7 -0
  160. package/dist/svelte5/components-flex/utils/obj-to-style.d.ts +2 -0
  161. package/dist/svelte5/components-flex/utils/parser.d.ts +5 -0
  162. package/dist/svelte5/components-flex/utils/prop-to-style.d.ts +11 -0
  163. package/dist/svelte5/components-flex/variants.d.ts +42 -0
  164. package/dist/svelte5/components-flex/youtube/types.d.ts +16 -0
  165. package/dist/svelte5/constants.d.ts +27 -0
  166. package/dist/svelte5/display-logic.d.ts +125 -0
  167. package/dist/svelte5/form.d.ts +100 -0
  168. package/dist/svelte5/functions.d.ts +71 -0
  169. package/dist/svelte5/hooks/useClickable.d.ts +7 -0
  170. package/dist/svelte5/hooks/useInjectCustomizeCss.d.ts +2 -0
  171. package/dist/svelte5/hooks/useText.d.ts +5 -0
  172. package/dist/svelte5/hydrate/action.d.ts +63 -0
  173. package/dist/svelte5/hydrate/actionEvent.d.ts +25 -0
  174. package/dist/svelte5/hydrate/collection.d.ts +121 -0
  175. package/dist/svelte5/hydrate/components/index.d.ts +32 -0
  176. package/dist/svelte5/hydrate/components-flex/avatar/styles.d.ts +3 -0
  177. package/dist/svelte5/hydrate/components-flex/avatar/types.d.ts +24 -0
  178. package/dist/svelte5/hydrate/components-flex/brand-kit.d.ts +16 -0
  179. package/dist/svelte5/hydrate/components-flex/button/styles.d.ts +8 -0
  180. package/dist/svelte5/hydrate/components-flex/button/types.d.ts +57 -0
  181. package/dist/svelte5/hydrate/components-flex/button-outlined/styles.d.ts +8 -0
  182. package/dist/svelte5/hydrate/components-flex/button-outlined/types.d.ts +20 -0
  183. package/dist/svelte5/hydrate/components-flex/button-text/styles.d.ts +6 -0
  184. package/dist/svelte5/hydrate/components-flex/button-text/types.d.ts +33 -0
  185. package/dist/svelte5/hydrate/components-flex/clip-copy/types.d.ts +6 -0
  186. package/dist/svelte5/hydrate/components-flex/close-button/types.d.ts +32 -0
  187. package/dist/svelte5/hydrate/components-flex/code/types.d.ts +6 -0
  188. package/dist/svelte5/hydrate/components-flex/count-down/types.d.ts +17 -0
  189. package/dist/svelte5/hydrate/components-flex/icon/styles.d.ts +3 -0
  190. package/dist/svelte5/hydrate/components-flex/icon/types.d.ts +18 -0
  191. package/dist/svelte5/hydrate/components-flex/image/styles.d.ts +3 -0
  192. package/dist/svelte5/hydrate/components-flex/image/types.d.ts +26 -0
  193. package/dist/svelte5/hydrate/components-flex/layout/types.d.ts +20 -0
  194. package/dist/svelte5/hydrate/components-flex/list/types.d.ts +30 -0
  195. package/dist/svelte5/hydrate/components-flex/modal/types.d.ts +5 -0
  196. package/dist/svelte5/hydrate/components-flex/multi-column/types.d.ts +31 -0
  197. package/dist/svelte5/hydrate/components-flex/props.d.ts +91 -0
  198. package/dist/svelte5/hydrate/components-flex/schemas.d.ts +36 -0
  199. package/dist/svelte5/hydrate/components-flex/shared/styles.d.ts +3 -0
  200. package/dist/svelte5/hydrate/components-flex/shared/types.d.ts +13 -0
  201. package/dist/svelte5/hydrate/components-flex/slider/types.d.ts +10 -0
  202. package/dist/svelte5/hydrate/components-flex/styles.d.ts +9 -0
  203. package/dist/svelte5/hydrate/components-flex/text/constants.d.ts +4 -0
  204. package/dist/svelte5/hydrate/components-flex/text/styles.d.ts +7 -0
  205. package/dist/svelte5/hydrate/components-flex/text/types.d.ts +37 -0
  206. package/dist/svelte5/hydrate/components-flex/text-link/styles.d.ts +6 -0
  207. package/dist/svelte5/hydrate/components-flex/text-link/types.d.ts +31 -0
  208. package/dist/svelte5/hydrate/components-flex/utils/color.d.ts +7 -0
  209. package/dist/svelte5/hydrate/components-flex/utils/obj-to-style.d.ts +2 -0
  210. package/dist/svelte5/hydrate/components-flex/utils/parser.d.ts +5 -0
  211. package/dist/svelte5/hydrate/components-flex/utils/prop-to-style.d.ts +11 -0
  212. package/dist/svelte5/hydrate/components-flex/variants.d.ts +42 -0
  213. package/dist/svelte5/hydrate/components-flex/youtube/types.d.ts +16 -0
  214. package/dist/svelte5/hydrate/constants.d.ts +27 -0
  215. package/dist/svelte5/hydrate/display-logic.d.ts +125 -0
  216. package/dist/svelte5/hydrate/form.d.ts +100 -0
  217. package/dist/svelte5/hydrate/functions.d.ts +71 -0
  218. package/dist/svelte5/hydrate/hooks/useClickable.d.ts +7 -0
  219. package/dist/svelte5/hydrate/hooks/useInjectCustomizeCss.d.ts +2 -0
  220. package/dist/svelte5/hydrate/hooks/useText.d.ts +5 -0
  221. package/dist/svelte5/hydrate/index.es.d.ts +79 -2956
  222. package/dist/svelte5/hydrate/index.es.js +5444 -6490
  223. package/dist/svelte5/hydrate/logger.d.ts +48 -0
  224. package/dist/svelte5/hydrate/modal.d.ts +214 -0
  225. package/dist/svelte5/hydrate/modal.svelte5.d.ts +214 -0
  226. package/dist/svelte5/hydrate/prop.d.ts +431 -0
  227. package/dist/svelte5/hydrate/script.d.ts +33 -0
  228. package/dist/svelte5/hydrate/stores.d.ts +376 -0
  229. package/dist/svelte5/hydrate/types.d.ts +183 -0
  230. package/dist/svelte5/hydrate/utils.d.ts +171 -0
  231. package/dist/svelte5/hydrate/widget.d.ts +148 -0
  232. package/dist/svelte5/index.es.d.ts +79 -2956
  233. package/dist/svelte5/index.es.js +5416 -6459
  234. package/dist/svelte5/index.front2.es.d.ts +1 -2
  235. package/dist/svelte5/index.front2.es.js +5657 -6715
  236. package/dist/svelte5/index.svelte5.d.ts +79 -0
  237. package/dist/svelte5/logger.d.ts +48 -0
  238. package/dist/svelte5/modal.d.ts +214 -0
  239. package/dist/svelte5/modal.svelte5.d.ts +214 -0
  240. package/dist/svelte5/prop.d.ts +431 -0
  241. package/dist/svelte5/script.d.ts +33 -0
  242. package/dist/svelte5/stores.d.ts +376 -0
  243. package/dist/svelte5/types.d.ts +183 -0
  244. package/dist/svelte5/utils.d.ts +171 -0
  245. package/dist/svelte5/widget.d.ts +148 -0
  246. package/dist/templates.cjs.js +38 -47
  247. package/dist/templates.d.ts +27 -28
  248. package/dist/templates.js +37 -46
  249. package/dist/types.d.ts +183 -0
  250. package/dist/utils.d.ts +171 -0
  251. package/dist/widget.d.ts +148 -0
  252. package/package.json +9 -18
  253. package/dist/hydrate/index.es.d.ts +0 -2988
  254. package/dist/templates.cjs.d.ts +0 -34
@@ -0,0 +1,148 @@
1
+ import { showAction, closeAction } from "./modal.js";
2
+ import { collection as newCollection } from "./collection.js";
3
+ type ChangeValCallbackArg = {
4
+ newVal: any
5
+ oldVal: any
6
+ key: string
7
+ };
8
+ type ChangeValCallback = (arg: ChangeValCallbackArg) => void;
9
+ type EventCallback = (event: any) => void;
10
+ type WidgetEventName = "hide" | "clickBackdrop" | "destroyed";
11
+ /**
12
+ * アクションを表示する
13
+ *
14
+ * @remarks
15
+ * この関数は {@link showAction} のエイリアスです
16
+ *
17
+ * @public
18
+ */
19
+ export { showAction as show };
20
+ /**
21
+ * アクションを非表示にする
22
+ *
23
+ * @remarks
24
+ * この関数は {@link closeAction} のエイリアスです
25
+ *
26
+ * @public
27
+ */
28
+ export { closeAction as hide };
29
+ /**
30
+ * 変数を設定する
31
+ *
32
+ * @param name - 変数名
33
+ * @param value - 変数値
34
+ *
35
+ * @public
36
+ */
37
+ export declare function setVal(name: string, value: any): void;
38
+ /**
39
+ * 変数を取得する
40
+ *
41
+ * @param name - 変数名
42
+ *
43
+ * @returns 変数値
44
+ *
45
+ * @public
46
+ */
47
+ export declare function getVal(name: string): any;
48
+ /**
49
+ * 変数が変更されたときに実行されるコールバック関数を設定する
50
+ *
51
+ * @param name - 変数名
52
+ * @param callback - コールバック関数
53
+ *
54
+ * @public
55
+ */
56
+ export declare function onChangeVal(name: string, callback: ChangeValCallback): void;
57
+ /**
58
+ * WEBのイベントが発生したときに実行されるコールバック関数を設定する
59
+ *
60
+ * @param name - WEBのイベント名
61
+ * @param callback - コールバック関数
62
+ *
63
+ * @public
64
+ */
65
+ export declare function method(name: string, callback: EventCallback): void;
66
+ /**
67
+ * Widgetのイベントが発生したときに実行されるコールバック関数を設定する
68
+ *
69
+ * @param name - Widgetのイベント名
70
+ * @param callback - コールバック関数
71
+ *
72
+ * @public
73
+ */
74
+ export declare function on(name: WidgetEventName, callback: EventCallback): void;
75
+ /**
76
+ * 現在のステートを設定する
77
+ *
78
+ * @param stateId - ステートID
79
+ *
80
+ * @public
81
+ */
82
+ export declare function setState(stateId: string): void;
83
+ /**
84
+ * 現在のステートを取得する
85
+ *
86
+ * @returns ステートID
87
+ *
88
+ * @public
89
+ */
90
+ export declare function getState(): string;
91
+ /**
92
+ * ページ内の変数を設定する
93
+ *
94
+ * @param key - 変数のキー
95
+ * @param value - 変数値
96
+ *
97
+ * @public
98
+ */
99
+ declare function setMemoryStore(key: string, value: any): void;
100
+ /**
101
+ * ページ内の変数を取定する
102
+ *
103
+ * @param key - 変数のキー
104
+ *
105
+ * @returns 変数
106
+ *
107
+ * @public
108
+ */
109
+ declare function getMemoryStore(key: string): any;
110
+ /**
111
+ * ページをまたぐ変数を設定する
112
+ *
113
+ * @param key - 変数のキー
114
+ * @param value - 変数値
115
+ *
116
+ * @public
117
+ */
118
+ declare function setLocalStore(key: string, value: any, options?: {
119
+ expire: number | boolean
120
+ }): void;
121
+ /**
122
+ * ページをまたぐ変数を取得設定する
123
+ *
124
+ * @param key - 変数のキー
125
+ *
126
+ * @returns 変数
127
+ *
128
+ * @public
129
+ */
130
+ declare function getLocalStore(key: string): any | undefined;
131
+ export declare const storage: {
132
+ memory: {
133
+ store: typeof setMemoryStore
134
+ restore: typeof getMemoryStore
135
+ }
136
+ local: {
137
+ store: typeof setLocalStore
138
+ restore: typeof getLocalStore
139
+ }
140
+ };
141
+ /**
142
+ * アクションテーブルを操作するオブジェクト
143
+ *
144
+ * @param table - アクションテーブル名
145
+ *
146
+ * @public
147
+ */
148
+ export declare function collection(table: string): ReturnType<typeof newCollection>;
@@ -1,16 +1,16 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
+ //#region src/templates.ts
3
4
  /**
4
- * 最新SDKに対応したアクションコードを生成する関数群
5
- */
5
+ * 最新SDKに対応したアクションコードを生成する関数群
6
+ */
6
7
  /**
7
- * アクションのアプリコード(App.svelte)の初期値の生成
8
- *
9
- * @internal
10
- */
11
- function createAppScript(script = '', icons = [], customComponents = []) {
12
- // TODO: `script` should be validated!
13
- return `<script lang="ts">
8
+ * アクションのアプリコード(App.svelte)の初期値の生成
9
+ *
10
+ * @internal
11
+ */
12
+ function createAppScript(script = "", icons = [], customComponents = []) {
13
+ return `<script lang="ts">
14
14
  // DON'T TOUCH THIS: SDK generates the following code
15
15
  import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
16
16
  import type { Data, Props, Variables } from './gen';
@@ -73,16 +73,12 @@ import {
73
73
  FlexClipCopy,
74
74
  } from '@plaidev/karte-action-sdk';
75
75
 
76
- ${icons.length > 0
77
- ? `import {\n ${icons.join(',\n ')},\n} from '@plaidev/karte-action-sdk/icons';`
78
- : ''}
76
+ ${icons.length > 0 ? `import {\n ${icons.join(",\n ")},\n} from '@plaidev/karte-action-sdk/icons';` : ""}
79
77
 
80
- ${customComponents
81
- .map(path => {
82
- const componentName = path.split('/').pop().replace('.svelte', '');
83
- return `import ${componentName} from '${path}';`;
84
- })
85
- .join('\n')}
78
+ ${customComponents.map((path) => {
79
+ const componentName = path.split("/").pop().replace(".svelte", "");
80
+ return `import ${componentName} from '${path}';`;
81
+ }).join("\n")}
86
82
 
87
83
  export let send: (event_name: string, values?: any) => void;
88
84
  let data_: Data;
@@ -111,13 +107,12 @@ $: cssVariables = getCssVariables({ ...$data, ...$actionVariables });
111
107
  </script>`;
112
108
  }
113
109
  /**
114
- * アクションのエントリーコード(index.tsx)の初期値の生成
115
- *
116
- * @internal
117
- */
118
- function createIndexTsx({ script = '' } = {}) {
119
- // TODO: `script` should be validated!
120
- return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
110
+ * アクションのエントリーコード(index.tsx)の初期値の生成
111
+ *
112
+ * @internal
113
+ */
114
+ function createIndexTsx({ script = "" } = {}) {
115
+ return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
121
116
  import { create } from '@plaidev/karte-action-sdk';
122
117
 
123
118
  import { props, localVariablesQuery, karteTemplate } from './gen';
@@ -140,26 +135,23 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
140
135
  export default action;`;
141
136
  }
142
137
  /**
143
- * 後方互換のためのカスタムスクリプトの初期値の生成
144
- *
145
- * customScript.tsが存在しない場合の後方互換コードを生成する。
146
- * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
147
- *
148
- * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
149
- * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
150
- *
151
- * @internal
152
- */
153
- function createCompatibleCustomScript({ script = '', templateType = 'webpopup', } = {}) {
154
- // TODO: `script` should be validated!
155
- if (templateType === 'script') {
156
- return `\
138
+ * 後方互換のためのカスタムスクリプトの初期値の生成
139
+ *
140
+ * customScript.tsが存在しない場合の後方互換コードを生成する。
141
+ * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
142
+ *
143
+ * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
144
+ * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
145
+ *
146
+ * @internal
147
+ */
148
+ function createCompatibleCustomScript({ script = "", templateType = "webpopup" } = {}) {
149
+ if (templateType === "script") return `\
157
150
  ${script}
158
151
  export default ({ send, data }) => {
159
152
  // ここにスクリプトを書いてください
160
153
  };`;
161
- }
162
- return `\
154
+ return `\
163
155
  import { showAction } from '@plaidev/karte-action-sdk';
164
156
  ${script}
165
157
  export default ({ send, data }) => {
@@ -167,13 +159,12 @@ export default ({ send, data }) => {
167
159
  showAction();
168
160
  };`;
169
161
  }
170
- // 以下は後方互換。action-editor-frontをデプロイしたら削除可能。
171
- // @internal
172
- function createCustomScript(script = '') {
173
- return createCompatibleCustomScript({ script });
162
+ function createCustomScript(script = "") {
163
+ return createCompatibleCustomScript({ script });
174
164
  }
175
165
 
166
+ //#endregion
176
167
  exports.createAppScript = createAppScript;
177
168
  exports.createCompatibleCustomScript = createCompatibleCustomScript;
178
169
  exports.createCustomScript = createCustomScript;
179
- exports.createIndexTsx = createIndexTsx;
170
+ exports.createIndexTsx = createIndexTsx;
@@ -1,34 +1,33 @@
1
1
  /**
2
- * 最新SDKに対応したアクションコードを生成する関数群
3
- */
2
+ * 最新SDKに対応したアクションコードを生成する関数群
3
+ */
4
4
  /**
5
- * アクションのアプリコード(App.svelte)の初期値の生成
6
- *
7
- * @internal
8
- */
9
- declare function createAppScript(script?: string, icons?: string[], customComponents?: string[]): string;
5
+ * アクションのアプリコード(App.svelte)の初期値の生成
6
+ *
7
+ * @internal
8
+ */
9
+ export declare function createAppScript(script?: string, icons?: string[], customComponents?: string[]): string;
10
10
  /**
11
- * アクションのエントリーコード(index.tsx)の初期値の生成
12
- *
13
- * @internal
14
- */
15
- declare function createIndexTsx({ script }?: {
16
- script?: string;
11
+ * アクションのエントリーコード(index.tsx)の初期値の生成
12
+ *
13
+ * @internal
14
+ */
15
+ export declare function createIndexTsx({ script }?: {
16
+ script?: string
17
17
  }): string;
18
18
  /**
19
- * 後方互換のためのカスタムスクリプトの初期値の生成
20
- *
21
- * customScript.tsが存在しない場合の後方互換コードを生成する。
22
- * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
23
- *
24
- * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
25
- * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
26
- *
27
- * @internal
28
- */
29
- declare function createCompatibleCustomScript({ script, templateType, }?: {
30
- script?: string;
31
- templateType?: 'webpopup' | 'script';
19
+ * 後方互換のためのカスタムスクリプトの初期値の生成
20
+ *
21
+ * customScript.tsが存在しない場合の後方互換コードを生成する。
22
+ * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
23
+ *
24
+ * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
25
+ * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
26
+ *
27
+ * @internal
28
+ */
29
+ export declare function createCompatibleCustomScript({ script, templateType }?: {
30
+ script?: string
31
+ templateType?: "webpopup" | "script"
32
32
  }): string;
33
- declare function createCustomScript(script?: string): ReturnType<typeof createCompatibleCustomScript>;
34
- export { createAppScript, createIndexTsx, createCompatibleCustomScript, createCustomScript };
33
+ export declare function createCustomScript(script?: string): ReturnType<typeof createCompatibleCustomScript>;
package/dist/templates.js CHANGED
@@ -1,14 +1,14 @@
1
+ //#region src/templates.ts
1
2
  /**
2
- * 最新SDKに対応したアクションコードを生成する関数群
3
- */
3
+ * 最新SDKに対応したアクションコードを生成する関数群
4
+ */
4
5
  /**
5
- * アクションのアプリコード(App.svelte)の初期値の生成
6
- *
7
- * @internal
8
- */
9
- function createAppScript(script = '', icons = [], customComponents = []) {
10
- // TODO: `script` should be validated!
11
- return `<script lang="ts">
6
+ * アクションのアプリコード(App.svelte)の初期値の生成
7
+ *
8
+ * @internal
9
+ */
10
+ function createAppScript(script = "", icons = [], customComponents = []) {
11
+ return `<script lang="ts">
12
12
  // DON'T TOUCH THIS: SDK generates the following code
13
13
  import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
14
14
  import type { Data, Props, Variables } from './gen';
@@ -71,16 +71,12 @@ import {
71
71
  FlexClipCopy,
72
72
  } from '@plaidev/karte-action-sdk';
73
73
 
74
- ${icons.length > 0
75
- ? `import {\n ${icons.join(',\n ')},\n} from '@plaidev/karte-action-sdk/icons';`
76
- : ''}
74
+ ${icons.length > 0 ? `import {\n ${icons.join(",\n ")},\n} from '@plaidev/karte-action-sdk/icons';` : ""}
77
75
 
78
- ${customComponents
79
- .map(path => {
80
- const componentName = path.split('/').pop().replace('.svelte', '');
81
- return `import ${componentName} from '${path}';`;
82
- })
83
- .join('\n')}
76
+ ${customComponents.map((path) => {
77
+ const componentName = path.split("/").pop().replace(".svelte", "");
78
+ return `import ${componentName} from '${path}';`;
79
+ }).join("\n")}
84
80
 
85
81
  export let send: (event_name: string, values?: any) => void;
86
82
  let data_: Data;
@@ -109,13 +105,12 @@ $: cssVariables = getCssVariables({ ...$data, ...$actionVariables });
109
105
  </script>`;
110
106
  }
111
107
  /**
112
- * アクションのエントリーコード(index.tsx)の初期値の生成
113
- *
114
- * @internal
115
- */
116
- function createIndexTsx({ script = '' } = {}) {
117
- // TODO: `script` should be validated!
118
- return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
108
+ * アクションのエントリーコード(index.tsx)の初期値の生成
109
+ *
110
+ * @internal
111
+ */
112
+ function createIndexTsx({ script = "" } = {}) {
113
+ return `import type { KarteAction, Send, Publish, Props, Variables } from './gen';
119
114
  import { create } from '@plaidev/karte-action-sdk';
120
115
 
121
116
  import { props, localVariablesQuery, karteTemplate } from './gen';
@@ -138,26 +133,23 @@ const action = (options: { send: Send; publish: Publish, props: Props; variables
138
133
  export default action;`;
139
134
  }
140
135
  /**
141
- * 後方互換のためのカスタムスクリプトの初期値の生成
142
- *
143
- * customScript.tsが存在しない場合の後方互換コードを生成する。
144
- * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
145
- *
146
- * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
147
- * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
148
- *
149
- * @internal
150
- */
151
- function createCompatibleCustomScript({ script = '', templateType = 'webpopup', } = {}) {
152
- // TODO: `script` should be validated!
153
- if (templateType === 'script') {
154
- return `\
136
+ * 後方互換のためのカスタムスクリプトの初期値の生成
137
+ *
138
+ * customScript.tsが存在しない場合の後方互換コードを生成する。
139
+ * 実際のコードはアクションテンプレートごとに異なるため、この関数で生成するコードを不用意に初期値にしないこと。
140
+ *
141
+ * export defaultの引数をシンプルにするため、標準のアクションで使わない変数をpropsに入れていない。
142
+ * 標準以外の使い方をするケースはサポートドキュメントでフォローする。
143
+ *
144
+ * @internal
145
+ */
146
+ function createCompatibleCustomScript({ script = "", templateType = "webpopup" } = {}) {
147
+ if (templateType === "script") return `\
155
148
  ${script}
156
149
  export default ({ send, data }) => {
157
150
  // ここにスクリプトを書いてください
158
151
  };`;
159
- }
160
- return `\
152
+ return `\
161
153
  import { showAction } from '@plaidev/karte-action-sdk';
162
154
  ${script}
163
155
  export default ({ send, data }) => {
@@ -165,10 +157,9 @@ export default ({ send, data }) => {
165
157
  showAction();
166
158
  };`;
167
159
  }
168
- // 以下は後方互換。action-editor-frontをデプロイしたら削除可能。
169
- // @internal
170
- function createCustomScript(script = '') {
171
- return createCompatibleCustomScript({ script });
160
+ function createCustomScript(script = "") {
161
+ return createCompatibleCustomScript({ script });
172
162
  }
173
163
 
174
- export { createAppScript, createCompatibleCustomScript, createCustomScript, createIndexTsx };
164
+ //#endregion
165
+ export { createAppScript, createCompatibleCustomScript, createCustomScript, createIndexTsx };
@@ -0,0 +1,183 @@
1
+ /**
2
+ * アクションの汎用的なタイプを定義する
3
+ *
4
+ * モーダル(ポップアップ)やアクションテーブルなど機能別のタイプは含めない。
5
+ */
6
+ /**
7
+ * アクションのイベントハンドラ
8
+ *
9
+ * @public
10
+ */
11
+ export type ActionEventHandler = (...args: any[]) => any | Promise<any>;
12
+ /**
13
+ * アクションの変数
14
+ *
15
+ * @public
16
+ */
17
+ export type ActionVariables = {
18
+ [key: string]: any
19
+ };
20
+ /**
21
+ * アクションの send 関数
22
+ *
23
+ * @public
24
+ */
25
+ export type SendFunction = (event_name: string, values?: any) => void;
26
+ /**
27
+ * アクションの publish 関数
28
+ *
29
+ * @public
30
+ */
31
+ export type PublishFunction = (topic: string, values?: any) => void;
32
+ /**
33
+ * アクション設定
34
+ *
35
+ * @public
36
+ */
37
+ export type ActionSetting = {
38
+ send?: SendFunction
39
+ publish?: PublishFunction
40
+ initialState?: string
41
+ };
42
+ /**
43
+ * アクションのライフサイクル changeState で呼び出されるフック関数
44
+ *
45
+ * @param props - アクションのプロパティ
46
+ * @param newState - アクションの新しいステート
47
+ *
48
+ * @public
49
+ */
50
+ export type ActionChangeStateHook<
51
+ Props,
52
+ Variables
53
+ > = (props: Parameters<ActionHook<Props, Variables & ActionVariables>>[0], newState: string) => void | Promise<void>;
54
+ /**
55
+ * アクションのプロパティ
56
+ *
57
+ * @public
58
+ */
59
+ export interface ActionProps<
60
+ Props,
61
+ Variables
62
+ > {
63
+ /**
64
+ * アクションでイベントがトリガーされたときに受信するための関数
65
+ */
66
+ send: SendFunction;
67
+ /**
68
+ * アクション内でタグのQueueにリクエストを発行する関数
69
+ */
70
+ publish: PublishFunction;
71
+ /**
72
+ * アクションで使用されるデータ
73
+ */
74
+ data: Props & Variables & ActionVariables;
75
+ /**
76
+ * アクションが表示されたときにフックされる {@link onShow}
77
+ */
78
+ onShow?: ActionHook<Props, Variables & ActionVariables>;
79
+ /**
80
+ * アクションのステートが変更されたときにフックされる {@link onChangeState}
81
+ */
82
+ onChangeState?: ActionChangeStateHook<Props, Variables & ActionVariables>;
83
+ }
84
+ /**
85
+ * アクションのライフサイクルで呼び出されるフック
86
+ *
87
+ * @param props - アクションのプロパティ
88
+ *
89
+ * @public
90
+ */
91
+ export type ActionHook<
92
+ Props,
93
+ Variables
94
+ > = (props: ActionProps<Props, Variables & ActionVariables>) => void | Promise<void>;
95
+ /**
96
+ * {@link create} 向けのオプション
97
+ *
98
+ * @public
99
+ */
100
+ export interface ActionOptions<
101
+ Props,
102
+ Variables,
103
+ VariablesQuery
104
+ > {
105
+ /**
106
+ * アクション内でイベントを発火する関数
107
+ *
108
+ * @defaultValue `() => {}`
109
+ */
110
+ send?: SendFunction;
111
+ /**
112
+ * アクション内でタグのQueueにリクエストを発行する関数
113
+ *
114
+ * @defaultValue `() => {}`
115
+ */
116
+ publish?: PublishFunction;
117
+ /**
118
+ * アクションで使用されるプロパティ
119
+ *
120
+ * @defaultValue `{}`
121
+ */
122
+ props?: Props;
123
+ /**
124
+ * アクションで使用される解析時に取得される変数
125
+ *
126
+ * @defaultValue `{}`
127
+ */
128
+ variables?: Variables;
129
+ /**
130
+ * アクションで使用されるアクション実行時に取得される変数
131
+ *
132
+ * @defaultValue `[]`
133
+ */
134
+ localVariablesQuery?: VariablesQuery;
135
+ /**
136
+ * アクションが作成されているときにフックされる {@link onCreate}
137
+ *
138
+ * @defaultValue `() => {}`
139
+ */
140
+ onCreate?: ActionHook<Props, Variables & ActionVariables>;
141
+ /**
142
+ * KARTEテンプレートの情報
143
+ *
144
+ * @defaultValue `{}`
145
+ */
146
+ karteTemplate?: {
147
+ [key: string]: any
148
+ };
149
+ /**
150
+ * アクション実行時のコンテキスト
151
+ */
152
+ context: ActionRunnerContext;
153
+ }
154
+ /**
155
+ * KARTE のシステム設定情報
156
+ *
157
+ * @public
158
+ */
159
+ export type SystemConfig = {
160
+ /**
161
+ * API キー
162
+ */
163
+ apiKey?: string
164
+ collection_endpoint?: string
165
+ /**
166
+ * 接客ID
167
+ */
168
+ campaignId?: string
169
+ shortenId?: string
170
+ };
171
+ /** @internal */
172
+ export type ActionHookLog = {
173
+ name: string
174
+ values?: any
175
+ };
176
+ /**
177
+ * アクション実行時のコンテキスト
178
+ */
179
+ export type ActionRunnerContext = {
180
+ api_key: string
181
+ collection_endpoint?: string
182
+ target?: "web" | "native"
183
+ };